110,565
社区成员
发帖
与我相关
我的任务
分享
public FormTest()
{
InitializeComponent();
tabControl1.MouseLeave += new EventHandler(tabControl1_MouseLeave);
}
void tabControl1_MouseLeave(object sender, EventArgs e)
{
if (!this.ClientRectangle.Contains(this.PointToClient(Cursor.Position)))
{
System.Console.WriteLine("move out tabControl1_MouseLeave");
}
}
private void frmZhiMa_MouseLeave(object sender, EventArgs e)
{
if (!this.ClientRectangle.Contains(this.PointToClient(Cursor.Position))) //<--
{
if (this.Location.Y < 20)
{
this.Location = new Point(this.Location.X, -this.Size.Height + 5);
}
}
}
private void timer1_Tick(object sender, EventArgs e)
{
Rectangle _Info = new Rectangle(Location.X, Location.Y, this.Width, this.Height);
if (!_Info.Contains(Cursor.Position))
{
if (this.Location.Y < 20)
{
this.Location = new Point(this.Location.X, -this.Size.Height + 5);
}
}
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
if (!this.Visible)
{
this.Show();
}
if (this.Location.Y == -this.Size.Height + 5)
{
this.Location = new Point(this.Location.X, 0);
}
timer1.Enabled = false;
}
private void frmZhiMa_MouseLeave(object sender, EventArgs e)
{
Rectangle _Info = new Rectangle(Location.X, Location.Y, this.Width, this.Height);
if (!_Info.Contains(Cursor.Position))
{
if (this.Location.Y < 20)
{
this.Location = new Point(this.Location.X, -this.Size.Height + 5);
}
}
}