Thread: MSVC++ ComboBox Color

  1. #1
    John S.

    MSVC++ ComboBox Color

    Anyone know how to change the background color in a ComboBox? I'm doing MFC programming using MSVC++ 6.0. From what I can see SetColor and BackgroundColor are not available. I would like to do this without redrawing the box if at all possible.

  2. #2
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    I seen code for this and it wasnt pretty. The way i viewed it you have to draw it your self. Unlike VB, where you can just change the number to what ever color you want. There is another way I think, but you might have to do some research on it.
    C++ Is Powerful
    I use C++
    There fore I am Powerful

  3. #3
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Using the standard win API you can trap the WM_CTLCOLOREDIT message for the editable part of the combo box and the WM_CTLCOLORLISTBOX message for the drop down box.

    For both of these messages the LPARAM is a handle to the control, from which you can obtain a DC and insert a new brush and background colour.

    I'm not entirely sure how you'd do this with MFC, but there may be a simpler method here.

  4. #4
    John S.

    Smile Thanks

    Thanks for the help... I went ahead and redrew the box. I was a pain and wasn't pretty, but it worked....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM
  2. egavga.bgi problem
    By sunil21 in forum A Brief History of
    Replies: 3
    Last Post: 09-22-2003, 05:06 PM
  3. My opinion on skin color
    By Leeman_s in forum A Brief History of
    Replies: 8
    Last Post: 07-11-2003, 12:12 PM
  4. console text color change in MSVC?
    By revelation437 in forum C++ Programming
    Replies: 1
    Last Post: 05-16-2003, 01:46 PM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM