屏幕从睡眠状态唤醒后,WPF 应用程序窗口未完全刷新

发布于 2024-10-14 13:13:23 字数 401 浏览 8 评论 0原文

今天,我们在一个 WPF 应用程序中发现了一个奇怪的问题,我们不确定如何处理它。当我们在一台笔记本电脑上运行该软件时,当没有用户交互时,屏幕会在一段时间后进入睡眠状态(变黑)。它的应用程序本身仍然忙于从互联网下载数据并填充数据库中的表格。还有一个进度条和一个状态栏。

如果我们仅通过移动鼠标来唤醒屏幕,程序将再次显示,但窗口的某些部分不会刷新。即使该过程完成,进度条仍然显示值,并且状态栏也是错误的。

从这时起,您可以像什么都没发生一样使用该程序,但是只有将任务栏的完整窗口最小化并再次最大化时,进度条和状态栏才会重新绘制。或者,如果您启动另一个也将使用进度栏或状态栏的操作。

这种奇怪的行为引起了很多混乱,因为屏幕从睡眠状态唤醒后显示的数据似乎是错误的,您需要最小化和最大化窗口才能查看到底发生了什么。

这里有什么问题吗?

Today we found a little strange problem in one of our WPF application and we are not exactly sure how to deal with it. When we run the software on one of our laptops the screen goes to sleep (turns black) after a while when there is no user interaction. It application itself is still busy downloading data from the internet and filling tables in a database. There is also a progress bar and a status bar.

If we wake the screen simply by moving the mouse the program is shown again but some parts of the window are not refreshed. The progress bar is still showing values even if the process is completed and the status bar is also wrong.

From this time on you can work with the program like nothing happened but progress bar and status bar will only be redrawn if you minimize the complete window to the task bar and maximize it again. Or if you start another action that will also use progress bar or status bar.

This strange behavior caused a lot of confusion because the displayed data seems to be wrong after the screen awakes from sleep and you need to minimize and maximize the window to see what is really going on.

What is wrong here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泅人 2024-10-21 13:13:23

视频驱动程序是最新的吗?如果没有,您可以尝试更新它们。 WPF 利用视频硬件进行渲染。我之前遇到过一些令人耳目一新的问题,新驱动程序修复了它。

Are the video drivers up to date? If not, you might try updating them. WPF utilizes video hardware for it's rendering. I have had some refreshing problems before and new drivers fixed it.

初见 2024-10-21 13:13:23

确保后台操作不会占用 UI 线程。但正如 Cory 所说,这可能是视频驱动程序问题。

Make sure that the background operation isn't hogging the UI thread. But as Cory suggests, it could be a video driver problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文