Winform 窗体淡出淡入效果
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;//窗體效果需要該包
namespace 軟件項(xiàng)目管理系統(tǒng)
{
public partial class LoginForm : Form
{
//窗體彈出或消失效果
[DllImport("user32.dll", EntryPoint = "AnimateWindow")]
private static extern bool AnimateWindow(IntPtr handle, int ms, int flags);
public const Int32 AW_HOR_POSITIVE = 0x00000001;
public const Int32 AW_HOR_NEGATIVE = 0x00000002;
public const Int32 AW_VER_POSITIVE = 0x00000004;
public const Int32 AW_VER_NEGATIVE = 0x00000008;
public const Int32 AW_CENTER = 0x00000010;
public const Int32 AW_HIDE = 0x00010000;
public const Int32 AW_ACTIVATE = 0x00020000;
public const Int32 AW_SLIDE = 0x00040000;
public const Int32 AW_BLEND = 0x00080000;
public LoginForm()
{
InitializeComponent();
//窗體彈出效果
AnimateWindow(this.Handle, 300, AW_CENTER);
}
?
//“關(guān)閉按鈕”事件
private void button1_Click(object sender, EventArgs e)
{
//窗體彈出效果
AnimateWindow(this.Handle, 300, AW_HIDE + AW_CENTER);
Application.Exit();
}
}
轉(zhuǎn)載于:https://www.cnblogs.com/viuu/p/7451614.html
總結(jié)
以上是生活随笔為你收集整理的Winform 窗体淡出淡入效果的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 基础 - 结构体大小计算
- 下一篇: 开发者论坛一周精粹(第二十期) :晒往期