如何刷新整个设备屏幕(Windows Mobile)?
我正在开发一个简单的应用程序,它每 2 秒在屏幕的设备上下文上绘制一张 alpha 混合图片,我想在绘制操作之前刷新屏幕内容(为了擦除绘制的图片),
我使用了很多技巧,但是不幸的是,屏幕无法正确刷新,某些区域仍然保留部分绘制的图片,
我对这个问题感到非常沮丧:(
这些是我使用过的源代码,我使用的是 C#,
SendMessage(HWND_BROADCAST, WM_SYSCOLORCHANGE, IntPtr.Zero, IntPtr.Zero); // wasted time in the refreshing process is enough to keep this.
UpdateWindow(HWND_BROADCAST);// does not work at all!
InvalidateRect(IntPtr.Zero,IntPtr.Zero,true); // the same goes here.
SendMessage(HWND_BROADCAST, WM_PAINT, IntPtr.Zero, IntPtr.Zero); // pfffff !
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, new IntPtr(SPI_SETNONCLIENTMETRICS), IntPtr.Zero); // trying to refresh the explorer, no resutl
我还使用了 EnumWindows 并回调,非常慢,不适合我的情况,
我想刷新整个屏幕,
!
帮忙
请
I'm working on a simple application that draws an alpha-blended picture on the screen's Device Context every 2 secs, I want to refresh the screen contents before the drawing operation (To erase the drawn pic),
I have used many many trick but unfortunately, the screen won't refresh correctly, some regions still keep portions of the drawn pic
I'm really frustrated from this issue :(
These are the sources codes I have used, I'm using C#
SendMessage(HWND_BROADCAST, WM_SYSCOLORCHANGE, IntPtr.Zero, IntPtr.Zero); // wasted time in the refreshing process is enough to keep this.
UpdateWindow(HWND_BROADCAST);// does not work at all!
InvalidateRect(IntPtr.Zero,IntPtr.Zero,true); // the same goes here.
SendMessage(HWND_BROADCAST, WM_PAINT, IntPtr.Zero, IntPtr.Zero); // pfffff !
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, new IntPtr(SPI_SETNONCLIENTMETRICS), IntPtr.Zero); // trying to refresh the explorer, no resutl
I used also EnumWindows and call back , very slow and does not fit my case.
I wanna refresh the whole screen
Help please!
Regards
Waleed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您能否在绘制任何内容之前复制屏幕图像,以便利用屏幕外构图?并且您不需要先要求其他所有内容重新绘制。
Could you instead copy the screen image before you draw anything, allowing you to take advantage of off-screen composition; and you wouldn't need to ask everything else to redraw first.
SendMessage(GetDesktopWindow(), WM_WININICHANGE, &HF2, 0)
SendMessage(GetDesktopWindow(), WM_WININICHANGE, &HF2, 0)