VB中每16毫秒保存1个图像 [英] Saving 1 Image Every 16 Millisecond in VB
问题描述
我想每16毫秒保存1个屏幕截图。所以每1秒就有60个截图。我尝试过使用计时器,但它没有用。 (Timer1 Interval = 16)
I want to save 1 Screenshot Every 16 Millisecond. So it is 60 screenshots every 1 Second. I tried using Timers but It didn't work. (Timer1 Interval = 16)
Public Class Form1
dim cf as integer = 0
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender as Object,e正如EventArgs)处理Timer1.Tick
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
cf = cf + 1
cf = cf + 1
      Dim bmp As Bitmap
      Dim area As Rectangle = My.Computer.Screen.Bounds
      bmp =新位图(area.Width,area.Height,System.Drawing.Imaging.PixelFormat.Format32bppArgb)
      Dim g As Graphics = Graphics.FromImage(bmp)
      g.CopyFromScreen(area.X,area.Y,0,0,area.Size,CopyPixelOperation.SourceCopy)
      bmp.Save(" D:/ FRAMES /"& cf&" .png")
 结束子
Dim bmp As Bitmap
Dim area As Rectangle = My.Computer.Screen.Bounds
bmp = New Bitmap(area.Width, area.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
Dim g As Graphics = Graphics.FromImage(bmp)
g.CopyFromScreen(area.X, area.Y, 0, 0, area.Size, CopyPixelOperation.SourceCopy)
bmp.Save("D:/FRAMES/" & cf & ".png")
End Sub
结束等级
End Class
$
推荐答案
我想保存1个屏幕截图每16毫秒。所以每1秒就有60个截图。
I want to save 1 Screenshot Every 16 Millisecond. So it is 60 screenshots every 1 Second.
每秒60帧是一部电影,不是截图。 这里有一个例子
60 frames per second is a movie, not a screenshot. There is an example here
https://stackoverflow.com/questions/4068414/how-to-capture-screen-to-be-video-using-c-sharp-net
您可以使用其中一个在线转换器转换为VB。 MS有一个可能有用的组件:
that you can convert to VB using one of the on-line converters. MS has a component that might be useful:
https://www.codeproject.com/Articles/8862/Capture-Activities-on-Screen-in-a-Movie
60fps将会推动它,可能需要商业SDK。
60fps is going to be pushing it, and might require a commercial SDK.
这篇关于VB中每16毫秒保存1个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!