VB.NET窗口画面撷取(ALT + PRINTSCREEN) [英] VB.NET Window Screen Capture (ALT+PRINTSCREEN)
问题描述
我发现,code的地方,我发现它非常有用,但我想找到一种方法,使其工作,因此只捕获指定的窗口的目标。也许有一个进程ID或窗口名称。即使该窗口是不活动。
I found that code somewhere and I find it quite useful but I would like to find a way to make it work so it capture only the given window target. Maybe with a processID or Window Name. Even if that window is not active.
我不想使该窗口有效,但希望得到一个屏幕捕捉一样,如果我在做ALT + PRINTSCREEN就可以了。
I do not want to make that window active but want to get a screen capture like if I was doing Alt+PrintScreen on it.
下面是code,它适用于全屏幕捕获
Here is the code that works for full Screen Capture
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例preSS
I use the Visual Basic 2008 Express
感谢你在前进!
推荐答案
这在vb.net2.0。我只是用它。 <一href="http://www.vbforums.com/showthread.php?385497-Easy-Screen-Capture-Class-Capture-Screen-Desktop-Region-Form-or-Controls"相对=nofollow>这是源$ C $ C。
This works in vb.net2.0. I just used it. Here is the source code.
Dim SC As New ScreenShot.ScreenCapture
'captures entire desktop straight to file
SC.CaptureScreenToFile("c:\accops\test\desktop2.jpg", Imaging.ImageFormat.Jpeg)
这篇关于VB.NET窗口画面撷取(ALT + PRINTSCREEN)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!