【VISUAL VB.NET】Screen Capture

 ' make sure that using System.IO; is included

Imports System.IO ' make sure that using System.Drawing.Imaging; is included Imports System.Drawing.Imaging Public Class Form1 Private tempfile As String = "C:\\Users\\Lorilla Family\\temp.jpg" Private Sub ScreanCapture() If Directory.Exists(Path.GetDirectoryName(tempfile)) Then pictureBox1.Image = Nothing File.Delete(tempfile) End If Dim bounds As Rectangle = Me.Bounds Using bitmap As New Bitmap(bounds.Width, bounds.Height) Using g As Graphics = Graphics.FromImage(bitmap) g.CopyFromScreen(New Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size) End Using bitmap.Save(tempfile, ImageFormat.Jpeg) End Using End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ScreanCapture() Dim fs As New FileStream(tempfile, FileMode.Open) ' pictureBox1.Image = new Bitmap(tempfile); PictureBox1.Image = New Bitmap(fs) fs.Close() End Sub End Class

No comments:

My New Favorite Music Genre Is Polish Noir

These 10 artists create music that is mystical, melancholy, magical, and more. ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏    ...

Contact Form

Name

Email *

Message *