Copy codeThe Code is as follows: 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); // The Center is gradually displayed.
// AnimateWindow (this. Handle, 1000, 0xA0000); // fade-in and fade-out effect.
// AnimateWindow (this. Handle, 1000, 0x60004); // top-down.
// AnimateWindow (this. Handle, 1000, 0x20004); // top-down.
}
Protected override void OnFormClosing (FormClosingEventArgs e)
{
Base. OnFormClosing (e );
AnimateWindow (this. Handle, 1000, 0x10010); // gradually hide the center.
// AnimateWindow (this. Handle, 1000, 0x90000); // fade-in and fade-out effect.
// AnimateWindow (this. Handle, 1000, 0x50008); // bottom-up.
// AnimateWindow (this. Handle, 1000, 0x10008); // bottom-up.
}
}
}