Chinaunix首页 | 论坛 | 博客
  • 博客访问: 175766
  • 博文数量: 89
  • 博客积分: 30
  • 博客等级: 民兵
  • 技术积分: 565
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-24 10:16
文章分类

全部博文(89)

文章存档

2013年(1)

2012年(1)

2011年(8)

2010年(45)

2009年(34)

我的朋友

分类: C/C++

2009-09-22 15:16:10

///截取电脑全屏

        private void button2_Click(object sender, EventArgs e)
        {
            Bitmap myImage 
= new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            Graphics g 
= Graphics.FromImage(myImage);
            g.CopyFromScreen(
new Point(00), new Point(00), new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
            IntPtr dc1 
= g.GetHdc();
            g.ReleaseHdc(dc1);
            myImage.Save(
@"c:\screen0.jpg");
        }

///截取窗体屏幕


        private void button3_Click(object sender, EventArgs e)
        {
            Bitmap myImage 
= new Bitmap(this.Width, this.Height);
            Graphics g 
= Graphics.FromImage(myImage);
            g.CopyFromScreen(
new Point(this.Location.X, this.Location.Y), new Point(00), new Size(this.Width, this.Height));
            IntPtr dc1 
= g.GetHdc();
            g.ReleaseHdc(dc1);
            myImage.Save(
@"c:\screen1.jpg");
        }
阅读(451) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~