快速拖动时 DragMove 不起作用?
我有一个应用程序,可以通过使用 DragMove 拖动具有典型模式的标题栏来移动:
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
它工作正常,但前提是我单击某个位置,然后拖动。如果我在将鼠标拖动到标题栏上时单击它,它不会移动。
除了 MouseLeftButtonDown 之外,我还需要挂钩其他事件吗?
I have an application that can moved by dragging the title bar with the typical pattern using DragMove:
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
It works fine, but only if I click in a spot, and then drag. If I click while dragging my mouse over the title bar it doesn't move.
Is there another event than MouseLeftButtonDown I need to hook to?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在 MouseLeftButtonDown 事件处理程序中调用 MyWindow.CaptureMouse(),然后在 MouseLeftButtonUp 事件处理程序中调用 MyWindow.ReleaseMouseCapture()。
Try calling MyWindow.CaptureMouse() in the MouseLeftButtonDown event handler and then calling MyWindow.ReleaseMouseCapture() in the MouseLeftButtonUp event handler.