【问题标题】:VB.NET Screen CaptureVB.NET 屏幕截图
【发布时间】:2014-01-21 16:00:32
【问题描述】:

大家好,我正在使用以下代码在 Visual Basic 2005 中捕获我的窗口窗体的黑色面板的屏幕截图。

我的问题是我希望红色边框图像介于两者之间并且是完整的。

我的代码:

    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)  `

【问题讨论】:

  • I want the red border image to come in between什么之间?
  • 里面有视频图像吗?
  • 红色边框中的图像应该覆盖整个屏幕,而不仅仅是占据那个角落
  • 视频是在您自己的程序中播放,还是在第三方程序中播放?如果是前者,你用什么来显示它,如果是后者,你应该找出是否有一个 API 可以让你从中获取静止图像。
  • 嗨,安德鲁,我正在使用 Directshowlib 在该面板中显示视频,但是在拍摄上述屏幕截图时,视频没有运行,你能帮帮我吗兄弟,因为它是我主要项目的一部分..thanx提前

标签: vb.net screen-capture


【解决方案1】:

您的代码运行良好,只需将边界设置为零

 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)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-02-03
    • 2015-07-07
    • 2016-07-08
    • 1970-01-01
    • 1970-01-01
    • 2021-07-12
    • 2014-09-26
    • 1970-01-01
    相关资源
    最近更新 更多