离开 MouseDown 控件后检测 MouseUp

Detect MouseUp after Leaving MouseDown Control

使用 VB.NET,除了向我的表单中的每个控件添加 mouseup 事件外,有没有人知道一种触发 mouseup 事件的方法,无论光标位于何处或光标位于哪个控件中?

或者有没有办法查看鼠标左键是否弹起,这样我可以在回车时执行,如果鼠标左键弹起则...

Or is there a way to see if the mouse left button is up, that way I can do on enter, if mouseup then...

Control class - Control.MouseButtons 上有一个静态 属性,returns,以基于标志的枚举形式,哪些按钮当前按下了鼠标。

var pressedButtons = Control.MouseButtons;
if (!pressedButtons.HasFlag(MouseButtons.Left))
{
    // Left mouse button is not down, so do stuff
}