Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS Tech Support » Themes and custom controls Collapse All
Subject Author Date
Ashley Gullen Jan 13, 2007 - 7:36 AM

Hi there,

While I love all the controls that come with this library, I also like to develop my own controls which are specialised for the interface I’m creating. Originally I used to use system colours to allow the interface to theme nicely with the users desktop. However, as the Prof-UI can be skinned to just about anything, I was wondering what’s the best way of allowing the colours in my controls to match the common colours of the skins in Prof-ui? Is it possible to manually draw things like the window background (which on some themes is a gradient) and suchlike?

Many thanks

Technical Support Jan 13, 2007 - 1:31 PM

There should not be problems with creating you controls compatible with Prof-UIS themes. However, there are two issues we would like to draw you attention to.

1. You should get colors using the g_PaintManager->GetColor() method rather than ::GetSysColor():

g_PaintManager->GetColor( COLOR_3DSHADOW )
2. Your painting procedure generally should look like:
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 );
For example you can use the following code to make your control’s background consistent with the current theme:
bool bTransparent = false;
if(    (! bTransparent )
   &&  PmBridge_GetPM()->GetCb2DbTransparentMode(this)
   )
{
    CExtPaintManager::stat_ExcludeChildAreas(
        dc,
        GetSafeHwnd(),
        CExtPaintManager::stat_DefExcludeChildAreaCallback
        );
    if( PmBridge_GetPM()->PaintDockerBkgnd( true, dc, this ) )
        bTransparent = true;
}
if( ! bTransparent )
    dc.FillSolidRect(
        &rcClient,
        PmBridge_GetPM()->GetColor( CExtPaintManager::CLR_3DFACE_OUT, this ) 
        );