[原创]屏幕部分截取工具
前段时间写的小程序。屏幕截取是个很常用的功能,但是Win自带的Print功能截取的范围太固定了(当前窗体或者全屏),因此平时要用屏幕截取时本人就只能开QQ了,但是开QQ太麻烦.并且被QQ窗体遮掩后的那部分窗体又截不到了,因此本程序诞生了!
一、主要原理:
通过两个窗体事件Mouse_Down和Mouse_UP来捕获鼠标移动的矩形区域,通过使用Graphics类的CopyFromScreen方法来把该矩形区域save到指定目录。
二、主要代码:
一、主要原理:
通过两个窗体事件Mouse_Down和Mouse_UP来捕获鼠标移动的矩形区域,通过使用Graphics类的CopyFromScreen方法来把该矩形区域save到指定目录。
二、主要代码:
CopyRight 2007 By SeeK [tseek1@gmail.com]
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
/// <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
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();
}
}
}
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
/// <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
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-----------------------------------
龟看上去很慢很慢,而且还有些憨,虽然没有兔子跑的快,但是只要有坚持不懈的毅力,就一定会到达成功的比彼岸.如果自己是龟,就不要试图把自己变成兔子,我就是那只憨龟。
龟看上去很慢很慢,而且还有些憨,虽然没有兔子跑的快,但是只要有坚持不懈的毅力,就一定会到达成功的比彼岸.如果自己是龟,就不要试图把自己变成兔子,我就是那只憨龟。