c#截屏
2013-11-02 15:53
323 查看
第一种:
第二种:
int m = 1; void PrintScreen() { System.Drawing.Size sz = Screen.PrimaryScreen.Bounds.Size; int width = sz.Width + 300;// 加300是为了测试双显示器时能否正常截屏 int height = sz.Height; using (Bitmap bit = new Bitmap(width, height)) using (Graphics g = Graphics.FromImage(bit)) { g.CopyFromScreen(this.Location, new System.Drawing.Point(0, 0), bit.Size); bit.Save(System.IO.Path.Combine(videoPath.Text, string.Format("{0}.jpg", m++))); g.Dispose(); } }
第二种:
static void printscreen2() { //截取屏幕内容 System.Drawing.Size screen = new System.Drawing.Size(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height); System.Drawing.Bitmap memoryImage = new System.Drawing.Bitmap(screen.Width, screen.Height); System.Drawing.Graphics memoryGraphics = System.Drawing.Graphics.FromImage(memoryImage); memoryGraphics.CopyFromScreen(0, 0, 0, 0, screen); memoryImage.Save(@"screen.bmp"); }
相关文章推荐
- C# WPF 控件截屏
- 用Java和C#编写一个截屏小程序
- C#实现截屏到本地硬盘 或传到服务器
- 关于C#截屏和绘制图片文字
- C#调用非托管DLL函数bitblt实现截屏
- c# 屏幕截屏工具
- C#截屏代码
- 少侠学截屏-C#屏幕捕捉的方式
- C#模拟QQ截屏功能
- c#截屏功能的实现
- c#抓屏(截屏)
- C# Webbrowser截屏 禁止弹出窗口及脚本错误提示 截取flash 视频
- 在C#中调用API进行截屏
- C# 键盘勾勒 打开,隐藏,关闭,截屏快捷键
- C# Webbrowser截屏 禁止弹出窗口及脚本错误提示 截取flash 视频
- C#(WPF)中使用WinAPI函数进行截屏
- C#模拟PrtScn实现截屏预备知识--剪贴板操作
- C# winform实现截屏,附代码
- 基于C#实现的屏幕指定区域截屏代码
- C#截屏程序实现(随笔日记)