<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      窗體打開特效

      [摘要]【效果圖】 【思路】: 在Form的OnLoad中 先使Form不可見,然后從內向外,一層一層繪制Rectangle ,最后讓Form可見【難點】 首先輸出效果的Rectangle要有個地方顯...
      【效果圖】


      【思路】:

      在Form的OnLoad中 先使Form不可見,然后從內向外,一層一層繪制Rectangle ,最后讓Form可見

      【難點】

      首先輸出效果的Rectangle要有個地方顯示,Main Form可不行,因為當繪制Rectangle的時候 ,Form是不可見的,這里使用了Desktop桌面

      【代碼如下】

      1. 加入命名空間

      using System.Drawing.Imaging;

      using System.Runtime.InteropServices;

      2. 聲明Win32 Api GetDC()

      [ DllImport("user32") ]

      public static extern System.IntPtr GetDC(System.IntPtr dc);

      3. 聲明變量

      System.Drawing.Graphics g; //畫圖板

      Pen p=new Pen(Color.Black,1); //畫筆

      int startx,starty,wx,wy,step; //startx,starty,wx,wy確定一個矩形

      int cx,cy; //cx,cy為form的client的width 和height

      4.在Form的OnLoad上加上如下代碼

      this.Visible=false;

      step=1;

      g=Graphics.FromHdc(GetDC(System.IntPtr.Zero));

      cx=this.ClientSize.Width;

      cy=this.ClientSize.Height;

      this.Visible=false;

      step=1;

      while(step<=cx/2)

      {

      startx=cx/2-step;

      starty=cy*startx/cx;

      wx=2*step;

      wy=wx*cy/cx;

      startx+=this.Left;

      starty+=this.Top+this.Height-this.ClientSize.Height;

      g.DrawRectangle(p,startx,starty,wx,wy);

      System.Threading.Thread.Sleep(100);

      step+=10;

      }

      this.Visible=true;



      ps:這是第一次發表原創, 大


      日韩精品一区二区三区高清