【发布时间】:2014-02-09 12:36:23
【问题描述】:
如何在不包含任务栏的情况下使用 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);
获取显示的工作区域。工作区是桌面 显示区域,不包括任务栏、停靠的窗口和停靠的 工具栏。
【讨论】: