您的位置:首页 > 编程语言

在屏幕上画图的C#实现代码

2009-12-25 08:23 302 查看
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 button object user