C# 动画窗体(AnimateWindow)的小例子
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# List<T>的Contains,Exists,Any,Where性能对比
这篇文章主要介绍了详解C# List<T>的Contains,Exists,Any,Where性能对比,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2020-12-12
C#(int)中Convert、Parse、TryParse的区别
Convert.ToInt32、int.Parse(Int32.Parse)、int.TryParse、(int) 四者都可以解释为将类型转换为 int,那它们的区别是什么呢?2013-04-04


最新评论