c# 实现窗体拖到屏幕边缘自动隐藏
来源:互联网 发布:淘宝注册账号网站 编辑:程序博客网 时间:2024/05/20 16:11
private void hide_Load(object sender, EventArgs e)
{
System.Windows.Forms.Timer StopRectTimer = new System.Windows.Forms.Timer();
StopRectTimer.Tick += new EventHandler(timer1_Tick);
StopRectTimer.Interval = 100;
StopRectTimer.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Bounds.Contains(Cursor.Position))
{
switch (this.StopAanhor)
{
case AnchorStyles.Top:
this.Location = new Point(this.Location.X, 0);
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.StopAanhor)
{
case AnchorStyles.Top:
this.Location = new Point(this.Location.X, (this.Height - 2) * (-1));
break;
case AnchorStyles.Left:
this.Location = new Point((-1) * (this.Width - 2), this.Location.Y);
break;
case AnchorStyles.Right:
this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - 2, this.Location.Y);
break;
}
}
}
internal AnchorStyles StopAanhor = AnchorStyles.None;
private void mStopAnhor()
{
if (this.Top <= 0)
{
StopAanhor = AnchorStyles.Top;
}
else if (this.Left <= 0)
{
StopAanhor = AnchorStyles.Left;
}
else if (this.Left >= Screen.PrimaryScreen.Bounds.Width - this.Width)
{
StopAanhor = AnchorStyles.Right;
}
else
{
StopAanhor = AnchorStyles.None;
}
}
private void hide_LocationChanged(object sender, EventArgs e)
{
this.mStopAnhor();
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/cbq926/archive/2009/02/01/3856519.aspx
- c# 实现窗体拖到屏幕边缘自动隐藏
- c# 实现窗体拖到屏幕边缘自动隐藏
- WinForm,窗体靠近屏幕边缘自动隐藏
- C# 窗体靠近屏幕边缘自动隐藏*学习(类似于QQ)
- C#实现窗体靠近屏幕边界自动隐藏
- Winform窗体实现类似停靠在屏幕边缘时自动隐藏的功能 .doc
- 窗体靠近屏幕边缘自动隐藏*学习(类似于QQ)
- Swing中窗体移到屏幕边缘自动隐藏
- Swing中窗体移到屏幕边缘自动隐藏
- VB6 窗体边缘自动隐藏
- C# WPF 如何禁止窗口拖到屏幕边缘自动最大化
- 实现悬浮窗口自动吸附到屏幕边缘
- C#实现窗口靠近屏幕边缘自动吸附
- 窗口在屏幕边缘自动隐藏的实现(动态收缩与动态弹出)
- C# 实现类似QQ的窗体在桌面边缘停靠和隐藏
- C# 屏幕监控 自动截屏程序 主窗体隐藏,仅在进程中显示
- QQ在屏幕边缘自动隐藏不能正常显示
- (转贴)C#窗体贴边自动隐藏组件
- SQL2005下通用分页存储过程,支持多字段排序,多表连接,多表嵌套
- [转]安全讲座
- MTK平台驱动基本介绍-1
- 历经磨难,程序员生涯终于开始
- MTK图层原理加案例讲解
- c# 实现窗体拖到屏幕边缘自动隐藏
- 颜色的数字表示
- 游戏开发入门图书推荐
- 只有两类消费电子设备能持续生存
- Java 面试题
- MTK调试入门之一 --- TRACE使用的技巧
- 房价为何还会涨?
- JS遍历所有以TextBox_开头匹配的文本框
- 虚拟机安装FC10,上网设置,smb共享设置 (1)