我想实现窗口的缩变,当点击一个按钮的时候,窗口由小变大并且有点淡入淡出的感觉。就像vista系统的效果一样。请各位大侠帮忙了!

解决方案 »

  1.   

    使用api DrawAnimatedRects,函数原型如下 
            [DllImport("user32.dll")]
            public static extern bool DrawAnimatedRects(
              IntPtr hwnd,
              int Ani,
              ref RECT from,
              ref RECT to);具体使用请参考msdn 相关api说明                      
      

  2.   

     [DllImport("user32.dll")]
            public static extern bool DrawAnimatedRects(
              IntPtr hwnd,
              int Ani,
              ref Rectangle from,
              ref Rectangle to);
            
            [DllImport("user32.dll")]
            static extern bool AnimateWindow(IntPtr hwnd, uint dwTime, uint dwFlags);
            public Form1()
            {           
                InitializeComponent();
            }        private void Form1_Load(object sender, EventArgs e)
            {
                Rectangle ee=new Rectangle(this.Location.X,this.Location.Y,this.Width,this.Height);
                Rectangle s=new Rectangle(this.Location.X+this.Width/2,this.Location.Y+this.Height/2,0,0);
                         //DrawAnimatedRects(Handle, 0x3, ref s, ref ee); 动态效果,速度比较快
                AnimateWindow(Handle, 1000, 0x0010); //这个api速度可以调,中间那个1000为1000毫秒        }
        }
      

  3.   

    就是定时起里设置窗体的size和opacity