【发布时间】:2021-08-01 07:58:01
【问题描述】:
只有当鼠标在鼠标左键按下时鼠标移到控件上时,我才需要更新控件。我通常会简单地检查 e.Button 属性,但它在 MouseEnter 事件中不可用。
void MyControl_MouseEnter(object sender, EventArgs e)
{
// MouseEventArgs needed to check this
// if (e.Button == MouseButtons.Left)
// {
// update MyControl
// }
}
你将如何做到这一点?
【问题讨论】:
-
在 MouseDown 和 MouseUp 中按下/释放鼠标按钮时,您能否解除技术,然后设置/清除上面代码中检查的标志?