06-07-21, 03:11 AM
06-07-21, 09:13 AM
06-07-21, 09:19 AM
(06-07-21, 03:51 AM)aldery كتب : [ -> ]هذا القسم الخطأ أخي أنتقل إلى قسم الجافا !
افتح مشروع جديد و اضف اليه ثلاث بوتن واحدة لالتقاط الصورة و الثاني لحفضها و الثالث لغلق البرنامج مع اضافة صندوق صورة(بيكتر بوكس) و مؤقت (تايمر) و اداة لحفظ الصورة(سايف فايل ديالوج)
ثم ضع الكود التالي
كود :
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Opacity = 0
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
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.Format32bppArgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
PictureBox1.Image = screenshot
Timer1.Enabled = False
Me.Opacity = 100
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim savefiledialog1 As New SaveFileDialog
Try
savefiledialog1.Title = "Save File"
savefiledialog1.FileName = "Untitled"
savefiledialog1.Filter = "PNG |*.png|JPEG |*.jpeg|BMP |*.bmp"
If savefiledialog1.ShowDialog() = DialogResult.OK Then PictureBox1.Image.Save(savefiledialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
Catch ex As Exception
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
End Class