C#中如何刷新整个屏幕?

javist 2007-03-05 09:43:21
rt
...全文
1878 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
li45214521 2007-03-05
  • 打赏
  • 举报
回复
查一查C++乍做的 调用系统API
javist 2007-03-05
  • 打赏
  • 举报
回复
windows的桌面
北京的雾霾天 2007-03-05
  • 打赏
  • 举报
回复
是整个windows的桌面
-----------------------------
是windows的桌面,还是桌面上的所有窗口?
javist 2007-03-05
  • 打赏
  • 举报
回复
是整个windows的桌面,谢谢关注。
北京的雾霾天 2007-03-05
  • 打赏
  • 举报
回复
你说的新整个屏幕是什么概念?
是新整桌面,还是新整桌上上打开的所有窗口.
aa2223 2007-03-05
  • 打赏
  • 举报
回复
winform?你点个按钮,在按钮事件里面写要刷新的内容.
web?你点个asp.net自带的按钮就刷新了!
javist 2007-03-05
  • 打赏
  • 举报
回复
非常感谢hbxtlhx(平民百姓)!
用RedrawWindow成功了!
北京的雾霾天 2007-03-05
  • 打赏
  • 举报
回复
或者用:
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool InvalidateRect(IntPtr hWnd, COMRECT rect, bool erase);

这个方法及上一个方法RedrawWindow中的COMRECT 的声明如下:
public class COMRECT
{
public int left;
public int top;
public int right;
public int bottom;
public COMRECT()
{
}
public COMRECT(int left, int top, int right, int bottom)
{
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
}

北京的雾霾天 2007-03-05
  • 打赏
  • 举报
回复
你可以调用如下的方法来实现你的要求:
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool RedrawWindow(IntPtr hwnd, COMRECT rcUpdate, IntPtr hrgnUpdate, int flags);

//调用示例如下:
RedrawWindow(GetDesktopWindow(), null, IntPtr.Zero, 0x85);
javist 2007-03-05
  • 打赏
  • 举报
回复
使用了别人得控件,不好查,不用该控件时正常,最后想出这个办法。
北京的雾霾天 2007-03-05
  • 打赏
  • 举报
回复
你一定是在某一个环节上出了问题,否则不会出错这个问题的.
北京的雾霾天 2007-03-05
  • 打赏
  • 举报
回复
你这是要实现桌面菜单的"刷新".

这个刷新有点耗资源的,如果你在程序中不停的调用这个方法,桌面会闪动的很历害的.
javist 2007-03-05
  • 打赏
  • 举报
回复
我有一个程序,在windowsXP运行正常,如果在windows2000下运行,当移动窗口时留下一个影子,用右键菜单的"刷新"一次就消失了,我想在程序中进行自动刷新屏幕。
王集鹄 2007-03-05
  • 打赏
  • 举报
回复
楼主你所谓刷新是嘛意思?比如。。。。。
北京的雾霾天 2007-03-05
  • 打赏
  • 举报
回复
你是出于什么目的来刷新桌面呢?
你如果是想实现在桌面上的右键菜单的"刷新"可不是这个方法.
javist 2007-03-05
  • 打赏
  • 举报
回复
感谢hbxtlhx
我这样调用:
UpdateWindow(GetDesktopWindow());
没有反应,不见有刷新。
北京的雾霾天 2007-03-05
  • 打赏
  • 举报
回复
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetDesktopWindow();
javist 2007-03-05
  • 打赏
  • 举报
回复
如何取得IntPtr hWnd?
北京的雾霾天 2007-03-05
  • 打赏
  • 举报
回复
用UpdateWindow这个函数来刷新.

[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool UpdateWindow(IntPtr hWnd);

111,086

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧