Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Vc++

  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Vc++

    How can I change the color of the background of a dialog in VC++?
    Note: I'm using windows XP & ME.

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have to capture some WM_CTLCOLOR* messages:
    Code:
    case WM_CTLCOLORDLG:
    case WM_CTLCOLORSTATIC:
    	   SetBkColor((HDC)wParam,RGB(255,0,0));
    	   return (BOOL)CreateSolidBrush(RGB(0,0,255));
    The SetBkColor sets the background (here RED) of your static text, if you don't have any, you don't have to use it.
    the return value is a handel to a brush (casted to BOOL) for a brush that we created. this will give a nice blue background

    for a bit more info on WM_CTLCOLORDLG from msdn
    If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the dialog box.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •