- Private buffer As Bitmap
- Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As IntPtr, ByVal X As Integer, _
- ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, _
- ByVal hSrcDC As IntPtr, ByVal xSrc As Integer, ByVal ySrc As Integer, _
- ByVal nSrcWidth As Integer, ByVal nSrcHeight As Integer, ByVal dwRop As Integer) As Integer
-
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim controlGraphics As Graphics = Me.PictureBox_Graphique.CreateGraphics ' graphique form
- Const SRCCOPY As Integer = &HCC0020
- Dim controlSize As Size
- controlSize = Me.PictureBox_Graphique.ClientSize()
- buffer = New Bitmap(controlSize.Width, controlSize.Height)
- Dim bufferGraphics As Graphics = controlGraphics.FromImage(buffer)
- Dim bufferHdc As IntPtr = bufferGraphics.GetHdc 'hdc de la form
- Dim controlHdc As IntPtr = controlGraphics.GetHdc
- StretchBlt(bufferHdc, 0, 0, controlSize.Width, controlSize.Height, _
- controlHdc, 0, 0, controlSize.Width, controlSize.Height, SRCCOPY)
- bufferGraphics.ReleaseHdc(bufferHdc)
- controlGraphics.ReleaseHdc(controlHdc)
- buffer.Save("C:\Documents and Settings\Ludo\Bureau\eeeezzz.Jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
Private buffer As Bitmap
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As IntPtr, ByVal X As Integer, _
ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, _
ByVal hSrcDC As IntPtr, ByVal xSrc As Integer, ByVal ySrc As Integer, _
ByVal nSrcWidth As Integer, ByVal nSrcHeight As Integer, ByVal dwRop As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim controlGraphics As Graphics = Me.PictureBox_Graphique.CreateGraphics ' graphique form
Const SRCCOPY As Integer = &HCC0020
Dim controlSize As Size
controlSize = Me.PictureBox_Graphique.ClientSize()
buffer = New Bitmap(controlSize.Width, controlSize.Height)
Dim bufferGraphics As Graphics = controlGraphics.FromImage(buffer)
Dim bufferHdc As IntPtr = bufferGraphics.GetHdc 'hdc de la form
Dim controlHdc As IntPtr = controlGraphics.GetHdc
StretchBlt(bufferHdc, 0, 0, controlSize.Width, controlSize.Height, _
controlHdc, 0, 0, controlSize.Width, controlSize.Height, SRCCOPY)
bufferGraphics.ReleaseHdc(bufferHdc)
controlGraphics.ReleaseHdc(controlHdc)
buffer.Save("C:\Documents and Settings\Ludo\Bureau\eeeezzz.Jpg", System.Drawing.Imaging.ImageFormat.Jpeg)