如图:
代码:
private void btnCutter_Click(object sender, EventArgs e)
{
Image img = new Bitmap(Screen.AllScreens[0].Bounds.Width, Screen.AllScreens[0].Bounds.Height);
Graphics g = Graphics.FromImage(img);
g.CopyFromScreen(new Point(0, 0), new Point(0, 0), Screen.AllScreens[0].Bounds.Size);
ScreenBody body = new ScreenBody();
body.BackgroundImage = img;
body.Show();
}
点击截屏按钮,会把整改屏幕以窗体背景图片属性放到另一个窗体。然后双击左键,屏幕就在剪切板中了,然后可以复制到qq或微信聊天框里。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ScreenCutter
{
public partial class ScreenBody : Form
{
public ScreenBody()
{
InitializeComponent();
this.WindowState = FormWindowState.Maximized;
}
private void ScreenBody_DoubleClick(object sender, EventArgs e)
{
if (((MouseEventArgs)e).Button == MouseButtons.Left)
{
//保存图片
Image memory = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(memory);
g.CopyFromScreen(this.Location.X + 1, this.Location.Y + 1, 0, 0, this.Size);
Clipboard.SetImage(memory);//把图片放到剪切板中
this.Close();
}
}
}
}