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 General Discussion » How to change background color? Collapse All
Subject Author Date
Artur Shingirei Jan 16, 2004 - 6:35 AM

I have dialog based application.
I did use Your library to set same UI look of my dialog. Then I want to change background color to another-RGB(255,255,255)
how to me it to make?

Technical Support Jan 16, 2004 - 7:54 AM

Dear Artur,

We assume your dialog is derived from the Prof-UIS’s CExtResizableDailog class. If it is so, please override the standard WindowProc() virtual method in the following manner:

LRESULT CMyDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
    if( message == WM_PAINT || 
        message == WM_ERASEBKGND || 
        ( message >= WM_CTLCOLORMSGBOX && message <= WM_CTLCOLORSTATIC ) )
    {
        return CDialog::WindowProc(message,wParam,lParam);
    }
    return CExtResizableDialog::WindowProc(message,wParam,lParam);
}
Then add the OnCtlColor() method to handle WM_CTLCOLOR messages and return the white brush (e.g. via calling ::GetStockObject(WHITE_BRUSH)) in it.
HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
    return (HBRUSH)::GetStockObject(WHITE_BRUSH);
}