资源简介
类似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文件
评论
共有 条评论