|
-
Jan 21st, 2022, 07:38 AM
#5
Thread Starter
Fanatic Member
Re: problem, my usercontrol is rendering outside the object visible rectangle area, w
 Originally Posted by LeandroA
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.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|