Screenshot (Ekran Görüntüsü) Alma
VB.NET ile resim cekme (screenhost).
Projemize 2 adet buton ve 1 adet picture box ekliyoruz.
Butonlarimizin isimleri Resim Cek ve Kayit et olarak yaziyoruz.
-
Resim cek butonu kodlari ;
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
-
Kayit et butonu ;
Dim savefiledialog1 As New SaveFileDialog
Try
savefiledialog1.Title = "Save File"
savefiledialog1.FileName = "*.jpeg"
savefiledialog1.Filter = "JPEG *.jpeg"
If savefiledialog1.ShowDialog() = DialogResult.OK Then
PictureBox1.Image.Save(savefiledialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
End If
Catch ex As Exception 'Do Nothing
End Try
Hiç yorum yok:
Yorum Gönder