1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Private Sub FermerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FermerToolStripMenuItem.Click
SaveFileDialog1.ShowDialog()
Dim gfx1 As Graphics = Me.BmpFormes.CreateGraphics
Dim gfx2 As Graphics = Nothing '
Try
Dim Bmp As New Bitmap(BmpFormes.Width, BmpFormes.Height, gfx1)
gfx2 = Graphics.FromImage(Bmp)
'BitBlt (Bit Block Transfer)
Dim hdc1 As IntPtr = gfx1.GetHdc
Dim hdc2 As IntPtr = gfx2.GetHdc
BitBlt(hdc2, 0, 0, BmpFormes.Width, BmpFormes.Height, hdc1, 0, 0, 13369376)
gfx1.ReleaseHdc(hdc1)
gfx2.ReleaseHdc(hdc2)
Bmp.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)
Catch ex As Exception
MessageBox.Show(ex.Message.ToString)
End Try
End Sub |
Partager