Salut
peut etre ainsi
Private Function Capturectrl(ByVal ctrl As Control) As Bitmap
Dim memoryImage As Bitmap
Dim memoryGraphics As Graphics
memoryImage = Nothing
Dim mygraphics As Graphics = ctrl.CreateGraphics()
Dim s As Size = ctrl.Size
If TypeOf ctrl Is Form AndAlso DirectCast(ctrl, Form).FormBorderStyle <> FormBorderStyle.None Then
memoryImage = New Bitmap(s.Width - 10, s.Height - (SystemInformation.FrameBorderSize.Width + 6 + SystemInformation.CaptionHeight), mygraphics)
memoryGraphics = Graphics.FromImage(memoryImage)
memoryGraphics.CopyFromScreen(0, (SystemInformation.FrameBorderSize.Width + 0 + SystemInformation.CaptionHeight), 0, 0, New Size(memoryImage.Width, memoryImage.Height), CopyPixelOperation.SourceCopy)
Else
memoryImage = New Bitmap(s.Width, s.Height, mygraphics)
memoryGraphics = Graphics.FromImage(memoryImage)
memoryGraphics.CopyFromScreen(ctrl.Left, ctrl.Top, 0, 0, New Size(memoryImage.Width, memoryImage.Height), CopyPixelOperation.SourceCopy)
End If
Return memoryImage
End Function
'dans un bouton
Private Sub ButtonSave_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ButtonSave.MouseClick
Dim saveimage As Bitmap
saveimage = Capturectrl(me)
saveimage.Save(pathfilename, ImageFormat.Jpeg)
end sub