Changing the color of a control

This is a discussion on Changing the color of a control within the Windows Programming forums, part of the Platform Specific Boards category; I'm somewhat new to C programming at Windows. I cannot find the message to change the color of a control, ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    14

    Question Changing the color of a control

    I'm somewhat new to C programming at Windows.
    I cannot find the message to change the color of a control, like an edit box.
    I'll use that when the control get and lost focus.

    What message can I use to change edits, listboxes, windows colors? What is its parameters?
    Dharius

  2. #2
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hey,

    I only know how to do it for an edit box:

    Code:
    case WM_CTLCOLOREDIT:
    HBRUSH hBrush; 
    
    
    hBrush = CreateSolidBrush(RGB(0, 0, 0));
    SetBkColor((HDC)wParam, RGB(0, 0, 0));
    			
    SetTextColor((HDC)wParam, RGB(0, 255, 0));
    
        return (DWORD)hBrush;

    Shoudnt be to hard to work out whats going on, also there may be a similar message for other controls like WM_CTLCOLORBTN, but i am prob wrong so check with msdn or somthing.

    Cheers,
    TNT

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    14
    Thanks, TNT.

    I'll look at that. Now I have some direction.
    Dharius

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 05:23 AM
  2. Changing static control text color
    By maxorator in forum Windows Programming
    Replies: 6
    Last Post: 11-03-2005, 09:03 AM
  3. changing edit control font
    By bennyandthejets in forum Windows Programming
    Replies: 6
    Last Post: 12-22-2002, 02:17 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Changing the image in a picture control
    By pinkcheese in forum Windows Programming
    Replies: 1
    Last Post: 04-15-2002, 03:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21