2
如何使用c#进行屏幕截图,包括任务栏。我尝试了一些代码,但它需要整个屏幕。使用c#进行屏幕截图,包括任务栏。
如何使用c#进行屏幕截图,包括任务栏。我尝试了一些代码,但它需要整个屏幕。使用c#进行屏幕截图,包括任务栏。
尝试Screen.PrimaryScreen.WorkingArea
它可以让你的屏幕不包括任务栏
Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.WorkingArea.Width,
Screen.PrimaryScreen.WorkingArea.Height,
PixelFormat.Format32bppArgb);
Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.WorkingArea.X,
Screen.PrimaryScreen.WorkingArea.Y,
0,
0,
Screen.PrimaryScreen.WorkingArea.Size,
CopyPixelOperation.SourceCopy);
bmpScreenshot.Save("Screenshot.png", ImageFormat.Png);
获取显示器的工作区域。工作区域是显示器的桌面 区域,不包括任务栏,停靠窗口和停靠的工具栏 。