登录
首页 » C# » 动画效果浮动窗体实例

动画效果浮动窗体实例

于 2015-06-10 发布
0 77
下载积分: 1 下载次数: 0

代码说明:

        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;                }            }        }

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696524资源总数
  • 103939会员总数
  • 12今日下载