最小化应用程序后,在恢复时,Windows 会追踪鼠标指针
我有一个 WPF C# 应用程序,除了其完成的目的之外,我还自定义了关闭和最小化按钮。问题是,当我最小化时,一切都很好,我循环所有其他应用程序,但是,当我想返回应用程序时,我单击任务栏中的窗口,然后弹出窗口...但是当它弹出,窗口在整个屏幕上跟踪鼠标指针...
我实现的代码是最简单的...
private void Minimize_LeftMouseDown(object sender, MouseButtonEventArgs e)
{
this.WindowState = WindowState.Minimized;
}
您能为我指出一些方向吗?
谢谢
I have an application in WPF C# where other than the purpose of what it's done, I customized the close and minimize buttons. The problem is that when I minimize, all is good, I cycle around all other apps, but, when I want to go back to the application, I click in the window in the taskbar, and the window pops up... But when it pops up, the window pursues the mouse pointer throughout the screen...
The code i've implemented the the simplest it can be...
private void Minimize_LeftMouseDown(object sender, MouseButtonEventArgs e)
{
this.WindowState = WindowState.Minimized;
}
Can you point me some directions?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能以某种方式捕获了此时的鼠标,并且最小化状态阻止了 WPF 的正常释放发生。如果您的控件名为“Minimize”,请尝试添加:
It's possible that you've somehow captured the mouse at that point, and the minimize state is preventing WPF's normal release from occurring. If your control is named "Minimize", try adding:
使用
LeftMouseUp
事件而不是LeftMouseDown
。您希望在释放鼠标时最小化窗口,而不是在按下鼠标时最小化窗口。Use the
LeftMouseUp
event instead ofLeftMouseDown
. You want to minimize the window when the mouse is released, not when it is pressed down.