|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Offer Har
|
Jan 5, 2007 - 10:05 AM
|
Hi,
I have a CWnd* Derived control inside a CExtResizableDialog dialog . I haev added this code to the drawing of the control as suggested by you before:
bool bTransparent = false;
if(! bTransparent && PmBridge_GetPM()->GetCb2DbTransparentMode(this)) { CExtPaintManager::stat_ExcludeChildAreas( *pDC, GetSafeHwnd(), CExtPaintManager::stat_DefExcludeChildAreaCallback );
if(PmBridge_GetPM()->PaintDockerBkgnd(true, *pDC, this)) { bTransparent = true; } }
if (! bTransparent) { pDC->FillSolidRect( &rc, PmBridge_GetPM()->GetColor(CExtPaintManager::CLR_3DFACE_OUT, this));
}
The problem is that this control appears 4 times in the dialog (and there are some other standard controls as well...), and what happens is that all controls in the dialog are not displayed, only the last control is displayed.
I think that what happens is that this piece of code draws the whole dialog with the background color, and that’s why none of the controls is shown.
I can see that when i resize the dialog, the controls appear for a short time (flicker), and dissapear again.
How can i make sure that the control repaints only its region and not the whole dialog?
Thanks.
|
|
Technical Support
|
Jan 5, 2007 - 10:42 AM
|
Please try the following code and let us know if the problem persists: CRect rcClient;
GetClientRect( &rcClient );
if( rcClient.IsRectEmpty() )
return;
CPaintDC dcPaint( this );
CExtMemoryDC dc(
&dcPaint,
&rcClient
);
CRgn rgnClient;
if( rgnClient.CreateRectRgnIndirect( &rcClient ) )
dc.SelectClipRgn( &rgnClient );
// ...
// ...
// PLACE YOUR PAINTING CODE HERE
// ...
// ...
if( rgnClient.GetSafeHandle() != NULL )
dc.SelectClipRgn( &rgnClient );
|
|
Offer Har
|
Jan 5, 2007 - 11:07 AM
|
Thanks, Problem solved.
Just for understanding - you need to repaint the complete background of the dialog for each control? Isn’t there a performance penalty?
|
|
Technical Support
|
Jan 6, 2007 - 6:05 AM
|
If you have a large number of controls (e.g. 50), you will certainly face some performance issues. But there is no other way to draw a solid gradient background. On the other hand, lots of controls on a dialog cannot be considered as a user-friendly design. For example, you could divide controls into lesser groups and smaller dialogs, tabs and etc. Another good solution could be a property grid control.
|
|
Offer Har
|
Jan 8, 2007 - 6:39 AM
|
Does the large number apply to ALL controls, including CExtLabel, CExtEdit etc.? If I don’t use theme with gradient background, does it still carry the same pennalty?
|
|
Technical Support
|
Jan 9, 2007 - 12:34 PM
|
This is applicable to all controls which need a gradient dialog background. Actually a custom background in painted in all themes. For some themes it is a gradient fill, for other ones it is a solid color fill (painted with FillSolidRect() method).
|
|