代码如下:
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll", EntryPoint = "GetDCEx", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags); private void button1_Click(object sender, EventArgs e)
{
IntPtr desk = GetDesktopWindow();
IntPtr deskDC = GetDCEx(desk,IntPtr.Zero,0x403);
Graphics g = Graphics.FromHdc(deskDC);
g.DrawString("Lightning",new Font("宋体",50,FontStyle.Bold),Brushes.Red,new PointF(100,100));
}
在桌面直接绘图后,被其他窗体遮住,如何进行重绘,谢谢.另外高手教下如何进行桌面绘图(不是窗体),多谢
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll", EntryPoint = "GetDCEx", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags); private void button1_Click(object sender, EventArgs e)
{
IntPtr desk = GetDesktopWindow();
IntPtr deskDC = GetDCEx(desk,IntPtr.Zero,0x403);
Graphics g = Graphics.FromHdc(deskDC);
g.DrawString("Lightning",new Font("宋体",50,FontStyle.Bold),Brushes.Red,new PointF(100,100));
}
在桌面直接绘图后,被其他窗体遮住,如何进行重绘,谢谢.另外高手教下如何进行桌面绘图(不是窗体),多谢
解决方案 »
- c#中如何实现控件大小随窗口大小的改变而改变呀?
- 散100分,求教C-Bus总线开发知识....欢迎讨论
- 求一正则表达式
- listbox添加图片
- 暂停循环和继的问题! 欢迎来看看!
- 一个LIST<INT>型,里面有N个数,求最大数为多少,并把它赋给一个LABLE.TEXT中
- jquery 如何给HiddenField赋值?
- 如何判断一个字符串中是否包含汉字??
- 怎么格式化这种XML?
- 借这个地方发个关于手机下载铃声的问题,望知道者赐教,谢
- 在vs2005自带的Sql Server删除一行数据时出现 未删除任何行
- 天啊,难道是我火星来的?try...catch...finally在这种情况下竟然不执行finally……
public static extern IntPtr GetDesktopWindow();[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool RedrawWindow(IntPtr hwnd, RECT rcUpdate, IntPtr hrgnUpdate, int flags);RedrawWindow(GetDesktopWindow(), null, IntPtr.Zero, 0x85);