基本信息
源码名称:动画效果浮动窗体实例
源码大小:0.07M
文件格式:.rar
开发语言:C#
更新时间:2015-06-10
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
private void StopRectTimer_Tick(object sender, EventArgs e)
{
//如果鼠标在窗体上,则根据停靠位置显示整个窗体
if (this.Bounds.Contains(Cursor.Position))
{
switch (this.StopDock)
{
case AnchorStyles.Top:
this.Location = new Point(this.Location.X, 0);
break;
case AnchorStyles.Bottom:
this.Location = new Point(this.Location.X, Screen.PrimaryScreen.Bounds.Height - this.Height);
break;
case AnchorStyles.Left:
this.Location = new Point(0, this.Location.Y);
break;
case AnchorStyles.Right:
this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - this.Width, this.Location.Y);
break;
}
}
else //如果鼠标离开窗体,则根据停靠位置隐藏窗体,但须留出部分窗体边缘以便鼠标选中窗体
{
switch (this.StopDock)
{
case AnchorStyles.Top:
this.Location = new Point(this.Location.X, (this.Height - 3) * (-1));
break;
case AnchorStyles.Bottom:
this.Location = new Point(this.Location.X, Screen.PrimaryScreen.Bounds.Height - 5);
break;
case AnchorStyles.Left:
this.Location = new Point((-1) * (this.Width - 3), this.Location.Y);
break;
case AnchorStyles.Right:
this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - 2, this.Location.Y);
break;
}
}
}
private void StopRectTimer_Tick(object sender, EventArgs e)
{
//如果鼠标在窗体上,则根据停靠位置显示整个窗体
if (this.Bounds.Contains(Cursor.Position))
{
switch (this.StopDock)
{
case AnchorStyles.Top:
this.Location = new Point(this.Location.X, 0);
break;
case AnchorStyles.Bottom:
this.Location = new Point(this.Location.X, Screen.PrimaryScreen.Bounds.Height - this.Height);
break;
case AnchorStyles.Left:
this.Location = new Point(0, this.Location.Y);
break;
case AnchorStyles.Right:
this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - this.Width, this.Location.Y);
break;
}
}
else //如果鼠标离开窗体,则根据停靠位置隐藏窗体,但须留出部分窗体边缘以便鼠标选中窗体
{
switch (this.StopDock)
{
case AnchorStyles.Top:
this.Location = new Point(this.Location.X, (this.Height - 3) * (-1));
break;
case AnchorStyles.Bottom:
this.Location = new Point(this.Location.X, Screen.PrimaryScreen.Bounds.Height - 5);
break;
case AnchorStyles.Left:
this.Location = new Point((-1) * (this.Width - 3), this.Location.Y);
break;
case AnchorStyles.Right:
this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - 2, this.Location.Y);
break;
}
}
}