前段时间写的小程序。屏幕截取是个很常用的功能,但是Win自带的Print功能截取的范围太固定了(当前窗体或者全屏),因此平时要用屏幕截取时本人就只能开QQ了,但是开QQ太麻烦.并且被QQ窗体遮掩后的那部分窗体又截不到了,因此本程序诞生了!
一、主要原理:
     通过两个窗体事件Mouse_Down和Mouse_UP来捕获鼠标移动的矩形区域,通过使用Graphics类的CopyFromScreen方法来把该矩形区域save到指定目录。
二、主要代码:

CopyRight 2007 By SeeK [tseek1@gmail.com]#region CopyRight 2007 By SeeK [tseek1@gmail.com]
 /**//*
  * 12/23/2007
  * This Program is written by SeeK [tseek1@gmail.com]
  * it's a screen intercept programer.
  * everyone who will change this source please send a mail to me.
  * */
 #endregion
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Text;
 using System.Windows.Forms;namespace 屏幕部分截取
 {
     public partial class Form1 : Form
     {
         Member Var Decline#region Member Var Decline
         private Point clickPoint;
         private Point currentPoint;
         private string path;
         #endregion
         /** <summary>
         /// Initialize form and decline some Event 
         /// </summary>
         public Form1()
         {
             InitializeComponent();
             this.MouseUp += new MouseEventHandler(Mouse_Up);
             this.MouseDown += new MouseEventHandler(Mouse_Down);
         }        System Events and Self define Events area#region System Events and Self define Events area
        private void Mouse_Down(object sender, MouseEventArgs e)
         {
             clickPoint = new Point(System.Windows.Forms.Control.MousePosition.X, System.Windows.Forms.Control.MousePosition.Y);
         }        private void Mouse_Up(object sender, MouseEventArgs e)
         {
             currentPoint = new Point(System.Windows.Forms.Control.MousePosition.X, System.Windows.Forms.Control.MousePosition.Y);
             saveFileDialog1.DefaultExt = "jpg"; 
             saveFileDialog1.Filter = "JPEG files (*.jpg)|*.jpg";
             if (saveFileDialog1.ShowDialog() == DialogResult.OK)
             {
                 path = saveFileDialog1.FileName;
             }
             if (SavePic())
             {
                 MessageBox.Show("图片成功保存在" + path);
                 this.WindowState = FormWindowState.Normal;
                 this.Opacity = 1.00;
             }
             else
             {
                 MessageBox.Show("保存失败!");
             }
         }
         /** <summary>
         /// setting form's opacity with a small double number and make form Maximized to get the point.
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
         private void button1_Click(object sender, EventArgs e)
         {
             this.Opacity = 0.01;
             this.WindowState = FormWindowState.Maximized;
             //this.Show();        }
         #endregion
         private bool SavePic()
         {
             Rectangle selectRec=new Rectangle(this.clickPoint.X,this.clickPoint.Y,this.currentPoint.X-this.clickPoint.X,this.currentPoint.Y-this.clickPoint.Y);
             try
             {
                 Bitmap pic = new Bitmap(selectRec.Width, selectRec.Height);
                 Graphics g = Graphics.FromImage(pic);
                 g.CopyFromScreen(clickPoint,Point.Empty, selectRec.Size);
                 pic.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);
                 return true;
             }
             catch
             {
                 return false;
             }
            
         }        private void btnExit_Click(object sender, EventArgs e)
         {
             Application.Exit();
         }
     }
 }
 SIGNATRUE-----------------------------------