using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 窗体翻转
{
public partial class Form1 : Form
{
//导入user32.dll
[System.Runtime.InteropServices.DllImport("user32.dll")]
//声明API函数
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
/*
* hwnd 界面上控件的句柄
* dwTime 窗体特效持续的时间(毫秒)
* dwFlags 窗体特效的值
*/
public Form1()
{
InitializeComponent();
}
private void button1_MouseClick(object sender, MouseEventArgs e)
{
AnimateWindow(this.Handle, 1000, 0x10010);//居中逐渐隐藏
AnimateWindow(this.Handle, 1000, 0x20010);//居中逐渐显示
AnimateWindow(this.Handle, 1000, 0x90000); // 淡入淡出效果。
AnimateWindow(this.Handle, 1000, 0xA0000); // 淡入淡出效果。
AnimateWindow(this.Handle, 1000, 0x50008); // 自下而上。
AnimateWindow(this.Handle, 1000, 0x60004); // 自上向下。
AnimateWindow(this.Handle, 1000, 0x10008); // 自下而上。
AnimateWindow(this.Handle, 1000, 0x20004); // 自上向下。
}
}
}