Bonjour à tous.
Je voudrais savoir faire une capture d'écran. Merci à qui pourra m'aider.
Bonnes fêtes de fin d'année.
Version imprimable
Bonjour à tous.
Je voudrais savoir faire une capture d'écran. Merci à qui pourra m'aider.
Bonnes fêtes de fin d'année.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Function captureScreen(ByVal locX As Integer, ByVal locY As Integer, ByVal width As Integer, ByVal height As Integer) As Bitmap Dim NewImage As New Bitmap(width, height) Using g As Graphics = Graphics.FromImage(NewImage) g.CopyFromScreen(locX, locY, 0, 0, NewImage.Size) End Using Return NewImage End Function 'exemple Sub SavePicturebox() Dim bit As Bitmap = captureScreen(PictureBox1.Location.X, PictureBox1.Location.Y, PictureBox1.Width, PictureBox1.Height) bit.Save("C:\fileName.jpg", Imaging.ImageFormat.Jpeg) End Sub Sub SaveWholeForm() Dim bit As Bitmap = captureScreen(Me.Location.X, Me.Location.Y, Me.Width, Me.Height) bit.Save("C:\fileName.jpg", Imaging.ImageFormat.Jpeg) End Sub
Merci, et bravo.
Enfin une réponse claire et pédagogique.
:plusser: hugoclo
Une autre solution existe aussi dans la FAQ, n'oubliez pas d'aller y faire un tour avant d'ouvrir une discussion, c'est plus rapide ;)
Bonnes fêtes de fin d'année.