Bonjour
J'ai une appli qui utilise une capture d'ecran pour ensuite sauvegarder cette capture en jpg.
Le size du form a capturer est : 745; 1035


ci joint le morceau du classimpression qui traite de la capture :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 Private Function Capturectrl(ByVal ctrl As Control) As Bitmap
        Dim memoryImage As Bitmap
        Dim mygraphics As Graphics = ctrl.CreateGraphics()
        Dim s As Size = ctrl.Size
        memoryImage = New Bitmap(s.Width - 3, s.Height - (SystemInformation.FrameBorderSize.Width + 3 + SystemInformation.CaptionHeight), mygraphics)
        Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
        Dim dc1 As IntPtr = mygraphics.GetHdc
        Dim dc2 As IntPtr = memoryGraphics.GetHdc
        StretchBlt(dc2, 0, 0, ctrl.ClientRectangle.Width, _
           ctrl.ClientRectangle.Height, dc1, 0, 0, 13369376)
        mygraphics.ReleaseHdc(dc1)
        memoryGraphics.ReleaseHdc(dc2)
        Return memoryImage
    End Function
Mon souci :
J'obtient une bande noire sur le jpeg capturé en bas et a droite de l'image comme ceci :


un peu comme si l'image avait été bien capturée mais que le "fond" du jpeg était noir

De quoi cela peut il venir d'après vous ?
Merci