using
System.Runtime.InteropServices;
[DllImport(
"user32"
)]
private
static
extern
bool
AnimateWindow(IntPtr hwnd,
int
dwTime,
int
dwFlags);
private
const
int
AW_HOR_POSITIVE = 0 x0001;
private
const
int
AW_HOR_NEGATIVE = 0 x0002;
private
const
int
AW_VER_POSITIVE = 0 x0004;
private
const
int
AW_VER_NEGATIVE = 0 x0008;
private
const
int
AW_CENTER = 0 x0010;
private
const
int
AW_HIDE = 0 x10000;
private
const
int
AW_ACTIVE = 0 x20000;
private
const
int
AW_SLIDE = 0 x40000;
private
const
int
AW_BLEND = 0 x80000;
private
void
Form1_Load(
object
sender, EventArgs e)
{
int
x = Screen.PrimaryScreen.WorkingArea.Right -
this
.Width;
int
y = Screen.PrimaryScreen.WorkingArea.Bottom -
this
.Height;
this
.Location =
new
Point(x, y);
AnimateWindow(
this
.Handle, 1000, AW_SLIDE | AW_ACTIVE | AW_VER_NEGATIVE);
}
private
void
Form1_FormClosing(
object
sender, FormClosingEventArgs e)
{
AnimateWindow(
this
.Handle, 1000, AW_BLEND | AW_HIDE);
}