使用C#实现在屏幕上画图效果的代码实例
时间:2021-07-18 08:24:36|栏目:.NET代码|点击: 次
以下这段C#代码实现的功能是在屏幕上画图的效果!具体代码如下:
复制代码 代码如下:
//DllImport所在的名字空间
using System.Runtime.InteropServices;
[DllImport("User32.dll")]
public extern static System.IntPtr GetDC(System.IntPtr hWnd);
private void button19_Click(object sender, EventArgs e)
{
System.IntPtr DesktopHandle = GetDC(System.IntPtr.Zero);
Graphics g = Graphics.FromHdc(DesktopHandle);
g.DrawRectangle(new Pen(Color.Red),new Rectangle(10,10,100,100));
}
上一篇:C#中RSA加密与解密的实例详解
栏 目:.NET代码
本文标题:使用C#实现在屏幕上画图效果的代码实例
本文地址:http://www.codeinn.net/misctech/158583.html






