如何刷新整个设备屏幕(Windows Mobile)?

发布于 2024-08-26 13:08:08 字数 787 浏览 3 评论 0原文

我正在开发一个简单的应用程序,它每 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 技术交流群。

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

发布评论

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

评论(2

扛起拖把扫天下 2024-09-02 13:08:08

您能否在绘制任何内容之前复制屏幕图像,以便利用屏幕外构图?并且您不需要先要求其他所有内容重新绘制。

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.

氛圍 2024-09-02 13:08:08
Declare Function SendMessage Lib "coredll.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr
Declare Function GetDesktopWindow Lib "coredll.dll" () As IntPtr
Private Const WM_WININICHANGE As Long = &H1A ' 0x1a = 26 ; &HF2 = 242

SendMessage(GetDesktopWindow(), WM_WININICHANGE, &HF2, 0)

Declare Function SendMessage Lib "coredll.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr
Declare Function GetDesktopWindow Lib "coredll.dll" () As IntPtr
Private Const WM_WININICHANGE As Long = &H1A ' 0x1a = 26 ; &HF2 = 242

SendMessage(GetDesktopWindow(), WM_WININICHANGE, &HF2, 0)

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