简体   繁体   English

用户单击任务栏上的程序时检测事件?

[英]Detect event when user clicks the program on the taskbar?

I want to know which event is firing in wpf window form if the user click my application on the taskbar to minimize or maximize the application. 如果用户在任务栏上单击我的应用程序以最小化或最大化应用程序,我想知道哪个事件以wpf窗口形式触发。 I just tried Activated and Deactivated events and, it's not working.I mean these events are triggering so many times. 我刚刚尝试过Activated和Deactivated事件,但它没有工作。我的意思是这些事件触发了很多次。 Thanks. 谢谢。

The Window.StateChanged event is fired after your window is minimized, maximized, or restored. 窗口最小化,最大化或恢复后,将触发Window.StateChanged事件。

However, if the window is simply obscured by other windows, clicking on the taskbar will bring it to front without changing its size. 但是,如果窗口被其他窗口遮挡,单击任务栏会将其显示在前面而不会改变其大小。 This will trigger the Activated event, but not StateChanged . 这将触发Activated事件,但不会触发StateChanged

You can use stateChanged event of the window. 您可以使用窗口的stateChanged事件。 It fires when window maximized and minimized i think it solves the problem. 它在窗口最大化和最小化时触发,我认为它解决了问题。

hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检测用户何时在控件外单击/轻击的事件 - Event to detect when user clicks/taps outside a control 用户单击以关闭消息窗口时发生的事件 - Event when user clicks to close message window 用户单击单选按钮时触发事件 - Firing an event when a user clicks a radio button 如何检测用户何时单击WebView控件中的超链接? - How can I detect when the user clicks on a hyperlink in a WebView control? 用户全局单击/释放鼠标按钮时的事件 - Event for when user clicks/releases mouse button globally 用户单击远离当前元素或子元素时获取事件 - Get event when user clicks away from current element or children 仅当用户单击ListBox时才引发DrawItem事件 - DrawItem event is fired only when the user clicks the ListBox 单击任务栏时,应用程序未收到事件 - Application not receiving event when clicked on taskbar 如何检测用户何时单击我的滑块而不是整体滑动? - How do I detect when a user clicks on my slider rather than just sliding in unity? 如何检测用户何时单击Windows Mobile(.NET CF 3.5)中的通知图标 - How can you detect when the user clicks on the notification icon in Windows Mobile (.NET CF 3.5)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM