Thread: Changing a windows background color

  1. #1
    Unregistered
    Guest

    Changing a windows background color

    I have searched but I can't find any tips on how to change a windows background color during a programs execution. I can change it before the window is registerd, but not afterward.

    how is that done??

    in advance, thanks

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Do you mean the client area?

    I havent checked, but I guess if you use CreateSolidBrush() to create another background colour, you can then call SelectObject() to select it........then if you repaint the client area it should be a different colour....

  3. #3
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    CClientDC pDC(this);

    RECT Rect;
    GetClientRect( &Rect );

    CBrush RedBrush( RGB( 255, 0, 0 ) );

    pDC.FillRect(&Rect, RedBrush);
    Invalidate();
    UpdateWindow();


    Something along the lines of that should fill it with red

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing static control text color
    By maxorator in forum Windows Programming
    Replies: 6
    Last Post: 11-03-2005, 10:03 AM
  2. Changing the background color
    By SwiftOutlaw in forum Windows Programming
    Replies: 3
    Last Post: 12-21-2004, 10:18 PM
  3. Codec Bitrates?
    By gvector1 in forum C# Programming
    Replies: 2
    Last Post: 06-16-2003, 08:39 AM
  4. FlashWindowEx not declared?
    By Aidman in forum Windows Programming
    Replies: 3
    Last Post: 05-17-2003, 02:58 AM
  5. Background Colour in Windows API
    By Vicked in forum Windows Programming
    Replies: 2
    Last Post: 04-14-2003, 03:49 AM