Quote Originally Posted by LeandroA View Post
when you call GdipCreateFromHDC don't use usercontrol.hdc until you call GdipDeleteGraphics

Code:
If VarTranslucency Then
    If mhToken = 0 Then Exit Sub
End If

If VarBackGroundPicture Is Nothing And VarBackGroundPicturehBitmap = 0 Then
    ' No tiene imagen de fondo.
    ' Aplica color de fondo.
    If UserControl.BackColor = VarBackColor Then
        Cls
    Else
        UserControl.BackColor = VarBackColor
    End If
Else
    ' Tiene imagen de fondo.
    If VarTranslucency = False Then
        VarBackGroundPicture.Render UserControl.hdc, --0, --CY, --CX, -CY, --0, --0, --VarBackGroundPicture.Width, --VarBackGroundPicture.Height, --0
    Else
        If VarBackGroundPicturehBitmap Then
            If GdipCreateFromHDC(UserControl.hdc, hGr) Then Exit Sub ' No viene de evento Paint.
            GdipDrawImageRectRectI hGr, VarBackGroundPicturehBitmap, 0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight, 0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight, UnitPixel, 0&, 0&, 0&
            GdipDeleteGraphics hGr
        End If
    End If
End If
ok, Thanks, closing the hGr each time it is used fixed the problem. So, where a Graphics context exist from UserControl.hDC, all normal drawing method of usercontrol fails ONLY IF is in the Form_Load stage. What a mess.