13-08-15, 12:23 PM
السلام عليكم
لقد وجدت سورس لتصوير سطح المكتب بجودة عالية ولكن بغيت لمساتكم عليه لجعله يقوم بتشغيل Webcam مع التصوير
كود التصوير لسطح المكتب :
Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
On Error Resume Next
Dim Count_Images As Integer = 0
For i = 0 To 1 Step 0 'We make the backgroundworker act like a timer
If BackgroundWorker1.CancellationPending = True Then
Exit For
Else
'My.Computer.Screen.Bounds Get The Size Of The Screen
Dim Path As String = Application.StartupPath & "\My Images\"
Dim Bmp As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim Gra As Graphics = Graphics.FromImage(Bmp)
Gra.CopyFromScreen(New Point(0, 0), New Point(0, 0), Bmp.Size)
Bmp.Tag = Count_Images
If IO.Directory.Exists(Path) = False Then
IO.Directory.CreateDirectory(Path)
End If
Kill(Path & Bmp.Tag & ".png")
Bmp.Save(Path & Bmp.Tag & ".png", Drawing.Imaging.ImageFormat.Png)
Count_Images += 1
End If
Next
End Sub
------------------
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
On Error Resume Next
If Button1.Text = "Record" Then
For Each Str As String In IO.Directory.EnumerateFiles(Application.StartupPath & "\My Images\", "*.png", IO.SearchOption.TopDirectoryOnly)
Kill(Str)
Next
BackgroundWorker1.RunWorkerAsync()
Button1.Text = "Stop"
Else
BackgroundWorker1.CancelAsync()
Button1.Text = "Record"
End If
End Sub
End Class
اتمنى المساعدة شباب
لقد وجدت سورس لتصوير سطح المكتب بجودة عالية ولكن بغيت لمساتكم عليه لجعله يقوم بتشغيل Webcam مع التصوير
كود التصوير لسطح المكتب :
Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
On Error Resume Next
Dim Count_Images As Integer = 0
For i = 0 To 1 Step 0 'We make the backgroundworker act like a timer
If BackgroundWorker1.CancellationPending = True Then
Exit For
Else
'My.Computer.Screen.Bounds Get The Size Of The Screen
Dim Path As String = Application.StartupPath & "\My Images\"
Dim Bmp As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim Gra As Graphics = Graphics.FromImage(Bmp)
Gra.CopyFromScreen(New Point(0, 0), New Point(0, 0), Bmp.Size)
Bmp.Tag = Count_Images
If IO.Directory.Exists(Path) = False Then
IO.Directory.CreateDirectory(Path)
End If
Kill(Path & Bmp.Tag & ".png")
Bmp.Save(Path & Bmp.Tag & ".png", Drawing.Imaging.ImageFormat.Png)
Count_Images += 1
End If
Next
End Sub
------------------
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
On Error Resume Next
If Button1.Text = "Record" Then
For Each Str As String In IO.Directory.EnumerateFiles(Application.StartupPath & "\My Images\", "*.png", IO.SearchOption.TopDirectoryOnly)
Kill(Str)
Next
BackgroundWorker1.RunWorkerAsync()
Button1.Text = "Stop"
Else
BackgroundWorker1.CancelAsync()
Button1.Text = "Record"
End If
End Sub
End Class
اتمنى المساعدة شباب
