日期:2014-05-17 浏览次数:21039 次
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//鼠标离开事件
private void Form1_MouseLeave(object sender, EventArgs e)
{
if (this.Location.Y == 0)
{
MoveFormHide();
}
}
//鼠标进入事件
private void Form1_MouseEnter(object sender, EventArgs e)
{
if (this.Location.Y < 0)
{
MoveFormShow();
}
}
//隐藏
private void MoveFormHide()
{
int step = this.Size.Height / 10;
for (int i = 0; i < 10; i++)
{
this.Location = new Point(this.Location.X, 0 - i * step);
System.Threading.Thread.Sleep(50);
}
}
//显示
private void MoveFormShow()
{
this.Location = new Point(this.Location.X, 0);
}
//以下为测试
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
this.Text = string.For