資源簡介
類似QQ的截圖功能,支持自動在屏幕上框出一片區域,然后保存為BMP格式,也可以抓取當前屏幕。

代碼片段和文件信息
using?System;
using?System.Drawing;
using?System.Windows.Forms;
namespace?Teboscreen
{
????public?partial?class?ControlPanel?:?Form
????{
????????string?ScreenPath;
????????private?Form?m_InstanceRef?=?null;
????????public?Form?InstanceRef
????????{
????????????get
????????????{
????????????????return?m_InstanceRef;
????????????}
????????????set
????????????{
????????????????m_InstanceRef?=?value;
????????????}
????????}
????????public?ControlPanel()
????????{
????????????InitializeComponent();
????????}
????????private?void?bttCaptureArea_Click(object?sender?EventArgs?e)
????????{
????????????this.Hide();
????????????Form1?form1?=?new?Form1();
????????????form1.InstanceRef?=?this;
????????????form1.Show();
????????}
????????private?void?bttExit_Click(object?sender?EventArgs?e)
????????{
????????????Application.Exit();
????????}
????????private?void?bttCaptureScreen_Click(object?sender?EventArgs?e)
????????{
????????????saveFileDialog1.DefaultExt?=?“bmp“;
????????????saveFileDialog1.Filter?=?“bmp?files?(*.bmp)|*.bmp“;
????????????saveFileDialog1.title?=?“Save?screenshot?to...“;
????????????saveFileDialog1.ShowDialog();
????????????ScreenPath?=?saveFileDialog1.FileName;
????????????//Conceal?this?form?while?the?screen?capture?takes?place
????????????this.WindowState?=?System.Windows.Forms.FormWindowState.Minimized;
????????????this.TopMost?=?false;
????????????//Allow?250?milliseconds?for?the?screen?to?repaint?itself?(we?don‘t?want?to?include?this?form?in?the?capture)
????????????System.Threading.Thread.Sleep(250);
????????????Rectangle?bounds?=?Screen.GetBounds(Screen.GetBounds(Point.Empty));
????????????ScreenShot.CaptureImage(Point.Empty?Point.Empty?bounds?ScreenPath);
????????????//The?screen?has?been?captured?and?saved?to?a?file?so?bring?this?form?back?into?the?foreground
????????????this.WindowState?=?System.Windows.Forms.FormWindowState.Normal;
????????????this.TopMost?=?true;
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
-----------?---------??----------?-----??----
????????????????54993????????????????????22
- 上一篇:c#遍歷一個文件夾下的所有文件包括子文件夾
- 下一篇:DE2引腳配置CSV文件
評論
共有 條評論