// 点击按钮开始捕捉屏幕 private void printScrBtn_Click(object sender, EventArgs e) { // 新建一个截图窗口 cutter = new Cutter(); // 隐藏原窗口 Hide(); Thread.Sleep(200); // 设置截图窗口的背景图片 Bitmap bmp = new Bitmap(Screen.AllScreens[0].Bounds.Width, Screen.AllScreens[0].Bounds.Height); Graphics g = Graphics.FromImage(bmp); g.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(bmp.Width, bmp.Height)); cutter.BackgroundImage = bmp; // 显示原窗口 Show(); // 显示截图窗口 cutter.WindowState = FormWindowState.Maximized; cutter.ShowDialog(); // 显示所截得的图片 UpdateScreen(); // 获取截图图片的图形设备 catchBmpGraphics = Graphics.FromImage(catchBmp); isSaved = false; }
// 点击按钮开始捕捉屏幕 private void printScrBtn_Click(object sender, EventArgs e) { // 新建一个截图窗口 cutter = new Cutter(); // 隐藏原窗口 Hide(); Thread.Sleep(200); // 设置截图窗口的背景图片 Bitmap bmp = new Bitmap(Screen.AllScreens[0].Bounds.Width, Screen.AllScreens[0].Bounds.Height); Graphics g = Graphics.FromImage(bmp); g.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(bmp.Width, bmp.Height)); cutter.BackgroundImage = bmp; // 显示原窗口 Show(); // 显示截图窗口 cutter.WindowState = FormWindowState.Maximized; cutter.ShowDialog(); textBox1.Text = ""; foreach (string p in ReadZB.point) { textBox1.Text += p + "\r\n"; } label1.Text = "设置坐标个数:" + ReadZB.point.Count; }