社区
C#
帖子详情
模仿QQ实现在屏幕边缘隐藏的功能,但是出现了一点小问题!
qiuji
2003-09-09 02:43:03
我分别使用Form1_MouseEnter,Form1_MouseLeave实现了隐藏和显示的功能,
但是问题是:
如果窗体上没有其他控件时,一切正常
如果有其他控件,当鼠标放到该控件时,会执行Form1_MouseLeave事件,这样窗体又隐藏了,怎样在此时让窗体不隐藏?像QQ那样。
...全文
105
5
打赏
收藏
模仿QQ实现在屏幕边缘隐藏的功能,但是出现了一点小问题!
我分别使用Form1_MouseEnter,Form1_MouseLeave实现了隐藏和显示的功能, 但是问题是: 如果窗体上没有其他控件时,一切正常 如果有其他控件,当鼠标放到该控件时,会执行Form1_MouseLeave事件,这样窗体又隐藏了,怎样在此时让窗体不隐藏?像QQ那样。
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
rainbowinfog
2003-09-13
打赏
举报
回复
up
ebluesky
2003-09-13
打赏
举报
回复
up
rouser
2003-09-10
打赏
举报
回复
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsApplication1
{
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Timer timer1;
private System.ComponentModel.IContainer components;
private int Seed = 3;
const int OUTSIDE = 9; // 3 pixels
const int WHOLE = 90; // whole height
private int STAY = 1;
private System.Windows.Forms.Timer timer2;
public Form2()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer2 = new System.Windows.Forms.Timer(this.components);
//
// timer1
//
this.timer1.Interval = 1;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// timer2
//
this.timer2.Interval = 500;
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
this.BackColor = System.Drawing.Color.Brown;
this.ClientSize = new System.Drawing.Size(560, 10);
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form2";
this.TopMost = true;
this.Load += new System.EventHandler(this.Form2_Load);
this.MouseEnter += new System.EventHandler(this.Form2_MouseEnter);
this.MouseLeave += new System.EventHandler(this.Form2_MouseLeave);
}
#endregion
private void Form2_Load(object sender, System.EventArgs e)
{
this.Top = 0;
this.Left = 0;
this.Width = Screen.PrimaryScreen.WorkingArea.Width;
this.Height = OUTSIDE;
}
private void timer1_Tick(object sender, System.EventArgs e)
{
if(this.Height >= WHOLE && Seed > 0)
{
this.timer1.Enabled = false;
}
if(this.Height <= OUTSIDE && Seed < 0)
{
this.timer1.Enabled = false;
this.timer2.Enabled = false;
}
this.Height += Seed;
}
private void timer2_Tick(object sender, System.EventArgs e)
{
STAY ++;
if(this.STAY == 2)
{
timer1.Enabled = true;
STAY = 0;
}
}
private void Form2_MouseEnter(object sender, System.EventArgs e)
{
if(this.Height == WHOLE)
return;
Seed = 3;
timer1.Enabled = true;
}
private void Form2_MouseLeave(object sender, System.EventArgs e)
{
if(this.Height == OUTSIDE)
return;
Seed = -3;
timer2.Enabled = true;
}
}
}
qiuji
2003-09-09
打赏
举报
回复
up
问道er
2003-09-09
打赏
举报
回复
我也在做这个,我们可以讨论一下吧!
我的qq:149724938
自动
隐藏
(类似
QQ
隐藏
)
这个标题"自动
隐藏
(类似
QQ
隐藏
)"所指的就是这种技术,通常用于即时通讯软件如
QQ
,当窗口靠近
屏幕
边缘
时,程序会自动缩至
屏幕
边缘
不可见,释放
屏幕
空间,而当鼠标靠近时又会重新
出现
,提供便捷的操作体验。...
WPF仿
QQ
贴边自动
隐藏
窗体
**WPF仿
QQ
贴边自动
隐藏
窗体**是一种在Windows Presentation Foundation(WPF)应用程序中
实现
的高级界面设计技巧,灵感来源于腾讯
QQ
的窗口行为。这个
功能
使得窗口能够智能地根据用户
屏幕
边缘
的位置进行吸附并自动...
VB 仿
QQ
窗体靠边自动
隐藏
【VB 仿
QQ
窗体靠边自动
隐藏
】是一种在Visual Basic (VB)编程环境中
实现
的窗口特效技术,它使得应用程序的窗体能够
模仿
QQ
聊天窗口的行为,即当窗体靠近
屏幕
边缘
时,窗体会自动
隐藏
或者吸附到
屏幕
边缘
,提供更便捷的...
C#
模仿
QQ
界面及
功能
【C#
模仿
QQ
界面及
功能
】 在编程领域,C#是一种广泛使用的面向对象的编程语言,尤其在开发Windows桌面应用方面具有强大的能力。本项目以"C#
模仿
QQ
界面及
功能
"为主题,旨在利用C#的WinForms库来创建一个类似
QQ
的应用...
QQ
靠边
隐藏
功能
的
实现
(vb.net)
这个
功能
使得程序窗口在靠近
屏幕
边缘
时自动
隐藏
,鼠标移到
隐藏
区域时窗体再次显示。以下是对
实现
这一
功能
的技术细节的详细说明: 首先,我们需要监听窗口的位置变化。在VB.NET中,我们可以重写`Form`类的`...
C#
111,110
社区成员
642,557
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章