模仿QQ实现在屏幕边缘隐藏的功能,但是出现了一点小问题! 我也在做这个,我们可以讨论一下吧!我的qq:149724938 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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; } }} ACtiveRecord查询 C#输出几行几列。 循环 强制转类型 问题 C# 引用Dll问题 JSON反序列化出现异常 超级菜鸟问题 这段代码update哪里有问题啊~!!!! DataGrid中添加和删除记录后不跟着刷新 c#读取txt文档内容如何单行显示 对接受的参数进行查询的问题!!急啊!! socket 客户端发送成功,服务端没有接收到也没报错 哪位朋友有最新版本的Developer Express Editors和Developer Express Grids控件? C#中打印窗体时,如何不弹出显示正在打印的小对话框?
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;
}
}
}