C# 截屏

2021-02-21 02:17

阅读:631

标签:save   图片   ali   map   大小   jpg   get   质量   .com   

 

 

  Rectangle rect = new Rectangle();//存储矩形大小位置
            rect = Screen.GetWorkingArea(this); //GetWorkingArea 获取屏幕工作区域,不包括工作栏任务栏
            Bitmap bit = new Bitmap(this.Width, this.Height);//实例化一个和窗体一样大的bitmap 
            Graphics g = Graphics.FromImage(bit);//创建绘图对象
            g.CompositingQuality = CompositingQuality.HighQuality;//质量设为最高
            g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片 
            Image MyImage = bit;
            MyImage.Save(@"c:/Capture.jpg", ImageFormat.Jpeg);

 

 Rectangle rect = new Rectangle();//存储矩形大小位置
            rect = Screen.GetBounds(this);//GetBounds 获取屏幕整个区域 
            Bitmap bit = new Bitmap(rect.Width, rect.Height);//实例化一个和窗体一样大的bitmap
            Graphics g = Graphics.FromImage(bit);
            g.CompositingQuality = CompositingQuality.HighQuality;//质量设为最高 
            g.CopyFromScreen(0, 0, 0, 0, new Size(rect.Width, rect.Height));//保存整个窗体为图片 
            Image MyImage = bit;
            MyImage.Save(@"c:/Capture.jpg", ImageFormat.Jpeg);

 

C# 截屏

标签:save   图片   ali   map   大小   jpg   get   质量   .com   

原文地址:https://www.cnblogs.com/lanyubaicl/p/8267385.html


评论


亲,登录后才可以留言!