Fork me on GitHub

winform控件添加鼠标事件

private Rectangle rectP;
rectP = new Rectangle(panel1.Location, panel1.Size);
private bool isInPanel;
private void panel_MouseMove(object sender, MouseEventArgs e)
{
       if (rectP.Contains(e.Location))
             isInPanel = true;
       else
             isInPanel = false;
}

  

posted @ 2016-08-31 09:58  千秋此意  阅读(3193)  评论(0编辑  收藏  举报