c#不使用系统api实现可以指定区域屏幕截屏功能
时间:2022-05-26 13:52:43
//截取全屏图象
private void btnFullScreen_Click(object sender, EventArgs e)
{
//创建图象,保存将来截取的图象
Bitmap image = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics imgGraphics = Graphics.FromImage(image);
//设置截屏区域
imgGraphics.CopyFromScreen(0, 0, 0, 0, new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
//保存
SaveImage(image);
}
//保存图象文件
private void SaveImage(Image image)
{
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
{
string fileName = saveFileDialog.FileName;
string extension = Path.GetExtension(fileName);
if (extension == ".jpg")
{
image.Save(fileName, ImageFormat.Jpeg);
}
else
{
image.Save(fileName, ImageFormat.Bmp);
}
}
}
标签:屏幕截屏,系统api
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
详解在LINUX上部署带有JAR包的JAVA项目
2022-12-30 21:07:14
![](https://img.aspxhome.com/file/2023/7/78427_0s.png)
mybatis-plus分页查询的实现示例
2023-11-25 04:57:57
![](https://img.aspxhome.com/file/2023/5/60025_0s.png)
SpringBoot基于Swagger2构建API文档过程解析
2022-12-06 20:42:58
![](https://img.aspxhome.com/file/2023/5/62205_0s.png)
SpringBoot结合Neo4j自定义cypherSql的方法
2022-05-18 00:41:07
springboot项目快速搭建的方法步骤
2021-11-07 04:55:51
![](https://img.aspxhome.com/file/2023/4/73074_0s.png)
c#删除指定文件夹中今天之前的文件
2022-02-26 22:57:27
Java多线程之多种锁和阻塞队列
2023-09-26 10:31:55
![](https://img.aspxhome.com/file/2023/4/81994_0s.png)
springboot配置文件中属性变量引用方式@@解读
2023-11-24 20:39:18
![](https://img.aspxhome.com/file/2023/6/59506_0s.png)
SpringDataJpa like查询无效的解决
2021-12-02 11:32:40
JAVA求两直线交点和三角形内外心的方法
2023-07-30 02:46:35
C#获取全部目录和文件的简单实例
2021-09-01 02:51:00
Java实现俄罗斯方块的源码分享
2023-02-17 04:20:48
![](https://img.aspxhome.com/file/2023/2/69902_0s.png)
浅谈spring security入门
2023-02-20 04:48:58
![](https://img.aspxhome.com/file/2023/2/63782_0s.png)
obix协议在java中的配置和使用详解
2023-11-25 20:59:42
![](https://img.aspxhome.com/file/2023/5/60275_0s.jpg)
JVM之参数分配(全面讲解)
2023-11-09 08:19:10
![](https://img.aspxhome.com/file/2023/8/83448_0s.png)
Java实现数据库连接池的方法
2023-11-28 08:57:30
解决IDEA service层跳转实现类的快捷图标消失问题
2022-09-03 06:38:00
![](https://img.aspxhome.com/file/2023/2/80212_0s.jpg)
SpringCloud之分布式配置中心Spring Cloud Config高可用配置实例代码
2021-06-23 16:48:08
![](https://img.aspxhome.com/file/2023/8/85408_0s.png)
如何将写好的.py/.java程序变成.exe文件详解
2022-04-06 09:22:14
![](https://img.aspxhome.com/file/2023/1/70161_0s.png)
Android手机联系人带字母索引的快速查找
2022-12-03 05:38:13
![](https://img.aspxhome.com/file/2023/5/98685_0s.png)