C# 动画窗体(AnimateWindow)的小例子
C# 动画窗体(AnimateWindow)的小例子
发布时间:2016-12-28 来源:查字典编辑
摘要:复制代码代码如下:usingSystem;usingSystem.Runtime.InteropServices;usingSystem.W...

复制代码 代码如下:

using System;

using System.Runtime.InteropServices;

using System.Windows.Forms;

namespace WinFormTitle

{

public partial class FormTitle : Form

{

[DllImport("user32.dll", EntryPoint = "AnimateWindow")]

private static extern bool AnimateWindow(IntPtr handle, int ms, int flags);

public FormTitle()

{

InitializeComponent();

this.StartPosition = FormStartPosition.CenterScreen;

}

protected override void OnLoad(EventArgs e)

{

base.OnLoad(e);

AnimateWindow(this.Handle, 1000, 0x20010); // 居中逐渐显示。

//AnimateWindow(this.Handle, 1000, 0xA0000); // 淡入淡出效果。

//AnimateWindow(this.Handle, 1000, 0x60004); // 自上向下。

//AnimateWindow(this.Handle, 1000, 0x20004); // 自上向下。

}

protected override void OnFormClosing(FormClosingEventArgs e)

{

base.OnFormClosing(e);

AnimateWindow(this.Handle, 1000, 0x10010); // 居中逐渐隐藏。

//AnimateWindow(this.Handle, 1000, 0x90000); // 淡入淡出效果。

//AnimateWindow(this.Handle, 1000, 0x50008); // 自下而上。

//AnimateWindow(this.Handle, 1000, 0x10008); // 自下而上。

}

}

}

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新C#教程学习
热门C#教程学习
编程开发子分类