2014-02-09 138 views

回答

1

尝试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); 

Screen.WorkingArea Property

获取显示器的工作区域。工作区域是显示器的桌面 区域,不包括任务栏,停靠窗口和停靠的工具栏 。