using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Drawing.Imaging;
using System.Text;
using System.Windows.Forms;

 
namespace WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

 
        private void button1_Click(object sender, EventArgs e)
        {
            CaptureImage(this.Location,new Point (0,0), new Rectangle(this.Location.X, this.Location.Y, this.Width,  this.Height), "c:\\ls.bmp");
        }

 
        public   void CaptureImage(Point SourcePoint, Point DestinationPoint,Rectangle SelectionRectangle, string FilePath)
        {
            using (Bitmap bitmap = new Bitmap(SelectionRectangle.Width,
                SelectionRectangle.Height))
            {
                using (Graphics g = Graphics.FromImage(bitmap))
                {
                    g.CopyFromScreen(SourcePoint, DestinationPoint,
                        SelectionRectangle.Size);
                }
                bitmap.Save(FilePath, ImageFormat.Bmp);
                bitmap.Dispose();
            }
        }
    }

 

 
}

最新文章

  1. sphinx :undefined reference to `libiconv' 报错解决办法
  2. shiro错误No SecurityManager accessible to the calling code
  3. java IO复习(三)
  4. RSA不对称加密,公钥加密私钥解密,私钥加密公钥解密
  5. Android源代码下载之《Android新闻client源代码》
  6. List Set Map用法和区别
  7. HTML 表单元素之 input 元素
  8. VC加载显示bmp图片的函数
  9. elasticsearch系列(三)分表分库
  10. 【Beta阶段】计划安排
  11. Loadrunner检查点使用总结
  12. 给echart初始化的dom节点绑定时间获取点击的值渲染省市区
  13. Linux 小知识翻译 - 「小型移动式PC」
  14. 【原创】有关Silverlight中 "Silverlight提示4004错误" 的解决方案及思路。
  15. nc工具学习
  16. [iOS微博项目 - 4.2] - 设置转发微博背景
  17. 正则表达式-RegExp-常用正则表达式
  18. 软工1816 · Alpha冲刺(4/10)
  19. Django学习笔记之Django视图View
  20. python接口测试(二)——配置文件的使用

热门文章

  1. SQLserver2008r2安装过程
  2. PHP连接SQL Server数据库
  3. Winform窗体间传递数据
  4. Nginx配置文件中文详解
  5. wpf C# 数据库 c/s 个人信息管理 wpf局域网通信
  6. Java 递归调用 recursive 给一个参数 返回一大堆
  7. IO(Input&Output)流の介绍
  8. Akka(33): Http:Marshalling,to Json
  9. SQL数据查询语句(一)
  10. Java基础笔记8