我發現代碼的某處,我覺得它非常有用,但我想找到一種方法使其工作,因此它只捕獲給定的窗口目標。可能帶有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