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 » Accesing the Theme's Background Collapse All
Subject Author Date
Jon Ort Jul 23, 2007 - 2:09 PM

I have a control that is a set size on a dialog. The data that the control displays generally does not take up the entire control. Before bringing in Prof-UIS I would get the dialog brush through a system call:

    hbr = GetSysColorBrush(COLOR_3DFACE);

and paint the "background" or empty areas with that brush.

How do I paint the proper background theme in my control when using Profi-UIS?

As well, how do we get a standard CFile dialog to appear in the correct theme?

Thanks
Jon

Jon Ort Jul 23, 2007 - 2:10 PM

Forgot the details: Profi-UIS 2.80 and Dev Studio 2005.

Jon Ort Jul 23, 2007 - 3:09 PM

(PS: It would be nice to be able to edit our own posts so that we don’t have to keep replying to ourselves :>)

I should also add that the entire control is being painted via a single GDI+ object. Therefore I need to paint the background onto a GDI+ surface.

Jon

Technical Support Jul 24, 2007 - 7:23 AM

The background of all controls and dialogs is based on bitmaps and gradients, which depend on the current paint manager (theme). For some themes it is a gradient fill, for other ones it is a solid color fill (painted with FillSolidRect() method).

Your custom controls should paint a valid background which is compatible with the dialog background and current theme. Here is how your OnPaint() may look:

void CYourWnd::OnPaint() 
{
    ASSERT_VALID( this );
    CPaintDC dcPaint( this );
    CRect rcClient;
    GetClientRect( &rcClient );
    if( rcClient.IsRectEmpty() )
        return;

    CExtMemoryDC dc(
        &dcPaint,
        &rcClient
        );

    CRgn rgnClient;
    if( rgnClient.CreateRectRgnIndirect( &rcClient ) )
        dc.SelectClipRgn( &rgnClient );

    // draw themed background first
    bool bTransparent = false;
    if( g_PaintManager->GetCb2DbTransparentMode( this ) )
    {
        CExtPaintManager::stat_ExcludeChildAreas(
            dc,
            GetSafeHwnd(),
            CExtPaintManager::stat_DefExcludeChildAreaCallback
            );
        if( g_PaintManager->PaintDockerBkgnd( true, dc, this ) )
            bTransparent = true;
    }
    if( ! bTransparent )
        dc.FillSolidRect(
            &rcClient,
            g_PaintManager->GetColor( CExtPaintManager::CLR_3DFACE_OUT, this )
            );


    //////////////////////////////////////////////////////////////////////
    // PLACE CONTROL PAINTING CODE HERE
    //////////////////////////////////////////////////////////////////////


    if( rgnClient.GetSafeHandle() != NULL )
        dc.SelectClipRgn( &rgnClient );    
    g_PaintManager->OnPaintSessionComplete( this );
}
As for the file dialog, the is no theme support for it at the moment.

Jon Ort Jul 26, 2007 - 3:44 PM

Thanks for the paintmanager info, that worked well for me.

The file dialog is a pretty major issue for us. Is there no way to get a skinned file dialog at all (not using the CFile MFC class?)

How are people handling this in their applications when the file open and file save look jarringly different from the rest of the program?

Thanks
Jon

Technical Support Jul 27, 2007 - 9:10 AM

Themed system dialogs are in our to-do list but it is unlikely that we will implement this in the next two releases. There are options, however. You could do this yourself using the following approach suggested by Leshchuk Aleksey. You can also contact our custom software development division so that they will implement this right now. In the later case, please contact Alex Cooper at info@prof-uis.com.