Professional UI Solutions
Site Map   /  Register


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 General Discussion » how could i get the base color of our prof-UIS-based project Collapse All
Subject Author Date
Adam chen Mar 2, 2009 - 8:17 AM

Hi expert, how could i get the base color (RGB value) of our prof-uis project when we change the theme from clicking theme toolbar button? for example, the office2007 Release2 base color is GRB(191,219,255). and the Office XP / Visual Studio.NET base color is RGB(239,237,222). I want to get this value when the theme changed. How to do this? Thanks for your help!

Technical Support Mar 2, 2009 - 9:44 AM

Generally, there is no base color in terms of Prof-UIS themes. For example, the skin based are using bitmap based backgrounds of all the UI elements. If you are coding some custom control and it should be themed using Prof-UIS APIs, the painting code should look like:

#if (!defined __EXT_MEMORY_DC_H)
            #include <../Src/ExtMemoryDC.h>

void CYourClass::OnPaint() 
CPaintDC dcPaint( this );
CRect rcClient;
            GetClientRect( &rcClient );
            if( rcClient.IsRectEmpty() )
CExtMemoryDC dc( &dcPaint, &rcClient );
bool bDrawDefaultBackground = true;
            if( g_PaintManager->GetCb2DbTransparentMode(this) && g_PaintManager->PaintDockerBkgnd( true, dc, this ) )
                        bDrawDefaultBackground = false;
            if( bDrawDefaultBackground )
                        dc.FillSolidRect( &rcClient, g_PaintManager->GetColor( CExtPaintManager::CLR_3DFACE_OUT, this ) );  
            // Themed background is ready. Draw your control over it here.

BOOL CYourClass::OnEraseBkgnd( CDC * pDC ) 
            return TRUE;
The g_PaintManager->PaintDockerBkgnd( true, dc, this ) code draws a themed background if the currently installed paint manager supports it. If the themed background is not painted, then the g_PaintManager->GetColor( CExtPaintManager::CLR_3DFACE_OUT, this ) is used for retrieving the default theme background color.