确定 Windows 窗体是否被遮挡
是否可以在.Net(或通过pinvoke)中确定窗口窗体是否被遮挡(即其他窗口已移至其上方,因此无法看到)?我正在做的是检查表单是否最小化,然后在任务栏上闪烁窗口(如果是)。然而问题是,如果它没有最小化,而是只是移动到后台,我还想通过在任务栏上闪烁窗口来通知用户。我不想将窗口自动移动到前台(即使没有激活)。我希望他们单击它以最大化和/或显示表单。有想法吗?
这是一些代码:
// See if we already have a conversation going with this person var frm = theApp.GetConversationByUID(fromuid); if (frm == null) { frm = theApp.NewConversation(fromuid, fromname); } else { bool withinView = frm.WindowState != FormWindowState.Minimized; if (withinView) { // Determine if window is just obstructed //TODO } // If the conversation window is not within view, then flash it if (!withinView) { FlashWindow.Flash(frm); } }
Is it possible in .Net (or thru pinvoke) to determine if a windows form is obstructed from view (i.e. other windows have been moved over top of it, so it cannot be seen)? What I am doing is checking if the form is minimized, then flashing the window on the taskbar if it is. However the problem is if it is NOT minimized, but just moved to the background, I also want to notify the user by flashing the window on the taskbar. I do not want to move the window to the foreground automatically (even without activation). I want them to click on it to maximize and/or show the form. Ideas?
Here's some code:
// See if we already have a conversation going with this person var frm = theApp.GetConversationByUID(fromuid); if (frm == null) { frm = theApp.NewConversation(fromuid, fromname); } else { bool withinView = frm.WindowState != FormWindowState.Minimized; if (withinView) { // Determine if window is just obstructed //TODO } // If the conversation window is not within view, then flash it if (!withinView) { FlashWindow.Flash(frm); } }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试此代码。
Try this code.