日期:2014-05-18 浏览次数:21153 次
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);
}
}
}
------解决方案--------------------
在TabControl 的MouseLeave里面一样的判断。
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");
}
}