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);
獲取顯示器的工作區域。工作區域是顯示器的桌面 區域,不包括任務欄,停靠窗口和停靠的工具欄 。