我发现代码的某处,我觉得它非常有用,但我想找到一种方法使其工作,因此它只捕获给定的窗口目标。可能带有processID或Window Name。即使该窗口不活动。VB.NET窗口屏幕捕获(ALT + PRINTSCREEN)
我不想让这个窗口处于活动状态,但想要获得一个屏幕截图,就像我在做Alt + PrintScreen一样。
这里是一个全屏幕捕捉作品的代码
Private bmpScreenShot As Bitmap
Private gfxScreenshot As Graphics
bmpScreenShot = New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb)
gfxScreenshot = Graphics.FromImage(bmpScreenShot)
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy)
bmpScreenShot.Save(fileName, ImageFormat.Png)
我使用Visual Basic 2008速成
预先感谢您!
可能重复的[活动窗口捕获截图?](http://stackoverflow.com/questions/1163761/capture-screenshot-of-active-window) – sloth 2014-04-14 13:24:16