社区
C#
帖子详情
模仿QQ实现在屏幕边缘隐藏的功能,但是出现了一点小问题!
qiuji
2003-09-09 02:43:03
我分别使用Form1_MouseEnter,Form1_MouseLeave实现了隐藏和显示的功能,
但是问题是:
如果窗体上没有其他控件时,一切正常
如果有其他控件,当鼠标放到该控件时,会执行Form1_MouseLeave事件,这样窗体又隐藏了,怎样在此时让窗体不隐藏?像QQ那样。
...全文
152
5
打赏
收藏
模仿QQ实现在屏幕边缘隐藏的功能,但是出现了一点小问题!
我分别使用Form1_MouseEnter,Form1_MouseLeave实现了隐藏和显示的功能, 但是问题是: 如果窗体上没有其他控件时,一切正常 如果有其他控件,当鼠标放到该控件时,会执行Form1_MouseLeave事件,这样窗体又隐藏了,怎样在此时让窗体不隐藏?像QQ那样。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用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
自动
隐藏
的代码,编译好直接能用
年底了,攒点人气,10月份说今年写博突破1000人的访问量是不可能了,哈哈下面是刚写的一个自动control
隐藏
类(模拟
QQ
自动
隐藏
),就一个静态方法,还算方便吧,明天继续发写日志的类using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using
[仿
QQ
聊天工具系列一]关于停靠
屏幕
边缘
时自动
隐藏
窗体的研究
虽说腾讯公司的很多软件和游戏都是“参考”他人的,但它凭借着它庞大的用户量可以将该“山寨”版软件变成“官方”版,估计这是腾讯公司的一种战略方针,只要它拥有这么多的用户和资金,它就可以打垮这些软件归属的所谓的“官方”公司。不是每家公司都能做的像腾讯这么成功的,虽说我不是很苟同它的一部分“参考”文化,但它的成功是不可否认的。当然腾讯公司也有自己的创新,而且有些方面做的比所谓的...
模仿
qq
屏幕
四周
隐藏
窗体
import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; i
Delphi下
QQ
窗体自动
隐藏
探索
腾讯
QQ
是当前流行的网络聊天工具之一,由于它在应用设计上有很多独特之处,所以也吸引了很多程序员对之进行研究和
模仿
。在这里,我将利用Delphi对
QQ
的窗体自动
隐藏
效果提出自己的
实现
方法。一、
问题
的提出熟悉
QQ
使用的朋友都知道,当
QQ
窗体区域超出
屏幕
四边时,窗体就会自动“消失”,只留下窗体一边的小部分显露在桌面上。当用鼠标移动到显露部分之上,窗体就会在
隐藏
位置重新完整显示;但当鼠标离开窗体区
C#WinForm仿
qq
窗体拖到windows窗体边上时,自动
隐藏
C#WinForm
C#WinForm仿
qq
窗体拖到windows窗体边上时,自动
隐藏
C#WinForm。代码: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void
C#
111,129
社区成员
642,540
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章