VB.NET 屏幕截图 [英] VB.NET Screen Capture
本文介绍了VB.NET 屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我正在使用下面的代码在 Visual Basic 2005 中捕获我的窗口窗体的黑色面板的屏幕截图.
Hello all i am using the below code to capture the screenshot of the black panel of my window form in visual basic 2005.
我的问题是我希望红色边框图像介于两者之间并且是完整的.
My problem is that I want the red border image to come in between and to be full.
我的代码:
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(618, 191, 850, 455, bounds.Size, CopyPixelOperation.SourceCopy)
screenshot.Save("d:\\dcap.bmp", Imaging.ImageFormat.Bmp) `
推荐答案
您的代码运行良好,只需将边界设置为零
Your code works well just set the bounds to zero
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(0, 0, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
screenshot.Save("d:\\dcap.jpg", Imaging.ImageFormat.Bmp)
这篇关于VB.NET 屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文