1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickDim G1 As Graphics = Me.CreateGraphics
Dim MyImage As Image = New Bitmap(Me.ClientRectangle.Width, Me.ClientRectangle.Height, G1)
Dim G2 As Graphics = Graphics.FromImage(MyImage)
Dim dc1 As IntPtr = G1.GetHdc
Dim dc2 As IntPtr = G2.GetHdc
BitBlt(dc2, 0, 0, Me.ClientRectangle.Width, Me.ClientRectangle.Height, dc1, 0, 0, TernaryRasterOperations.SRCCOPY)
G1.ReleaseHdc(dc1)
G2.ReleaseHdc(dc2)
TryMyImage.Save("c:\Captured.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
Catch ex As ExceptionMessageBox.Show(ex.Message)
EndTry
EndSub
|
Partager