用vb.net 编写最快的屏幕截屏程序
Imports System.Drawing.Imaging
Imports System.Drawing
Imports System.Runtime.InteropServices
Public Class Form1
Dim ScreenWidth As Integer = Screen.PrimaryScreen.Bounds.Width '获取屏幕宽度
Dim ScreenHeight As Integer = Screen.PrimaryScreen.Bounds.Height '获取屏幕高度
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim bmp As Bitmap = New Bitmap(ScreenWidth, ScreenHeight) '创建一个和屏幕大小相同的Bitmap图片对象
Dim g As Graphics = Graphics.FromImage(bmp) '从该位图创建Graphics对象
g .CopyFromScreen(0, 0, 0, 0, bmp .Size) '将整个桌面的内容绘制到我们新建的位图上(也就是截图)
bmp .Save("D:\test\screencapture" & Now() & ".jpg", ImageFormat .Jpeg ) '保存我们新绘制的位图(也就是截图)
g .Dispose() '释放Graphics对象
End Sub
End Class
创作工场
免责声明:
以上内容除特别注明外均来源于网友提问,创作工场回答,未经许可,严谨转载。
点击这里>>使用🔥专业版,更聪明、更完整、更原创!