一旦触发MouseEntered事件,我就会尝试将光标锁定到PictureBox中。
我想在键入Ctrl + Enter (或其他快捷方式,如果有相关的最佳实践)时取消此操作
我试着用here提到的方式来清理剪辑,但我认为我的MouseEnter一直在扼杀我必须离开的任何机会。
有什么办法可以解决这个问题吗?
发布于 2012-07-11 03:49:40
我不能百分之百确定你在这里问的是什么,因为你提到了你没有展示的MouseEnter活动。假设你会自己处理这件事,我实际上不同意那个帖子中被接受的答案。反编译您拥有的System.Windows.Forms:
internal static Rectangle ClipInternal
{
get
{
NativeMethods.RECT rECT = default(NativeMethods.RECT);
SafeNativeMethods.GetClipCursor(ref rECT);
return Rectangle.FromLTRB(rECT.left, rECT.top, rECT.right, rECT.bottom);
}
set
{
if (value.IsEmpty)
{
UnsafeNativeMethods.ClipCursor(null);
return;
}
NativeMethods.RECT rECT = NativeMethods.RECT.FromXYWH(value.X, value.Y, value.Width, value.Height);
UnsafeNativeMethods.ClipCursor(ref rECT);
}
}这似乎表明传递Rectangle.Empty是正确的答案。
发布于 2012-07-11 03:20:34
:根据this和this:设置为空矩形:
Cursor.Clip = Rectangle.Empty;https://stackoverflow.com/questions/11420175
复制相似问题