我如何单击控件并将其拖出(不是拖放),但只要单击按钮仍会跟踪事件?
我想允许用户在我的 UserControl 中单击并向左/向右拖动以放大/缩小,但我希望拖动不限于实际控件的边界。 什么样的事件或策略是跟踪控件和窗体之外的鼠标位置直到释放鼠标单击的正确方法?
预先感谢您的任何帮助或建议。
I would like to allow the user to click within my UserControl and drag left/right to zoom in/out but I'd like the dragging not to be restricted to the actual control's boundaries.
What sort of event or strategy would be the right way to track the mouse position outside the control and the form until the mouse click is released ?
Thanks in advance for any help or advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 MouseDown 事件处理程序中将 Capture 属性设置为 true。即使鼠标已离开客户区,您也会不断收到 MouseMove 消息。
Set the Capture property to true in a MouseDown event handler. You'll keep getting MouseMove messages, even if the mouse has left the client area.
我认为您正在寻找 Mouse.Capture< /a> 或类似的东西。
I think that you are after Mouse.Capture, or something similar.