从屏幕中心制作一个矩形屏幕截图

时间:2012-07-23 19:45:56

标签: vb.net screen screenshot center

我想知道如何从屏幕中心截取屏幕截图(大小为180x100)。 我怎么能这样做?

1 个答案:

答案 0 :(得分:1)

这可以为您提供所需的图像。 (编者)

Dim Img As New Bitmap(180, 100)
Dim g As Graphics = Graphics.FromImage(Img)
g.CopyFromScreen((Screen.PrimaryScreen.WorkingArea.Width / 2) - 90, _
    (Screen.PrimaryScreen.WorkingArea.Height / 2) - 50, _
    0, 0, Img.Size)
g.Dispose()