我想用一个按钮打印所有屏幕,并将其保存在任何文件夹中(我知道该怎么做)但我不知道如何拍照...另外一件事,我希望这个程序是HIDE它适用于一个键,例如f9或f11或任何键,但我希望这继续隐藏和工作,如何采取打印裤?如果它是隐藏的,如何工作?
感谢stackoverflow和partherns
答案 0 :(得分:4)
您可以使用以下方法截取单个窗口或整个屏幕的屏幕截图:
public void WindowsScreenshot()
{
// Full
Rectangle bounds = Screen.GetBounds(Point.Empty);
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
}
bitmap.Save("test_full.jpg", ImageFormat.Jpeg);
}
// Window
Rectangle bounds = this.Bounds;
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
}
bitmap.Save("test_window.jpg", ImageFormat.Jpeg);
}
}