---------------------引用上面的项目--------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.IO;
namespace MouseSelectImg
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private QinMi.CopyScreen cs;
        private void button1_Click(object sender, EventArgs e)
        {
            cs.GerScreenFormRectangle();
        }
        void cs_GetScreenImage(Image _image)
        {
            pictureBox1.Image = _image;
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            cs = new QinMi.CopyScreen();
            cs.GetScreenImage += new QinMi.CopyScreen.GetImage(cs_GetScreenImage);
        }
        //点击保存
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            sfd.ShowHelp = true;
            sfd.HelpRequest += new EventHandler(sfd_HelpRequest);
            sfd.Filter = "图片文件(*.jpg)|*.jpg|所有文件|*.*";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                //string path = MapPath("/" + Guid.NewGuid().ToString() + ".jpg").ToString();
                string path = sfd.FileName.ToString();
                pictureBox1.Image.Save(path, ImageFormat.Jpeg);
            }
        }
        private void sfd_HelpRequest(object sender, EventArgs e)
        {
            MessageBox.Show("输入文件名,保存到你指定的目录即可!");
        }
        public static string MapPath(string strPath)
        {
            if (System.Web.HttpContext.Current != null)
            {
                return System.Web.HttpContext.Current.Server.MapPath(strPath);
            }
            else //非web程序引用 
            {
                strPath = strPath.Replace("/", "\\");
                if (strPath.StartsWith("\\"))
                {
                    //strPath = strPath.Substring(strPath.IndexOf('\\', 1)).TrimStart('\\'); 
                    strPath = strPath.TrimStart('\\');
                }
                return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath);
            }
        }
    }
}

解决方案 »

  1.   

    这个是利用HOOK MOUSE来截图的.
    首先创建实例后,然后QinMi.CopyScreen类里的GetScreenImage 事件绑定cs_GetScreenImage方法,这样一旦事件触发,pictureBox1的图片也会更新成最新截取的图片.2.调用  cs.GerScreenFormRectangle();方法开始进行HOOK MOUSE,监视鼠标的状态变化,
    这样当你按下鼠标左键时,就开始准备截图,当左键放开时,截图区域就确定了
      

  2.   

       在命名空间中加入以入类,就可以运行了
     static class Program
        {
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
        }