Advertisement
MarkoMirkov18

Screenshot sa opcijom save

Jan 24th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. Visual basic- Screenshot program,obiฤan sa save opcijom
  2. Potrebno: 1 Button,1 Label,1 PictureBox
  3.  
  4. Public Class Form1
  5.  
  6.  
  7. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  8. Me.Hide()
  9. PictureBox1.Image = Nothing
  10. Dim bounds As Rectangle
  11. Dim screenshot As System.Drawing.Bitmap
  12. Dim graph As Graphics
  13. bounds = Screen.PrimaryScreen.Bounds
  14. screenshot = New Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
  15. graph = Graphics.FromImage(screenshot)
  16. graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
  17. PictureBox1.Image = screenshot
  18.  
  19. If SaveFileDialog1.ShowDialog = DialogResult.OK Then
  20. Label1.Text = SaveFileDialog1.FileName
  21. Me.Hide()
  22. End If
  23. PictureBox1.Image.Save(System.IO.Path.Combine(Label1.Text + ".png"))
  24. Me.Show()
  25.  
  26. End Sub
  27.  
  28. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement