MSVC++ ComboBox Color

This is a discussion on MSVC++ ComboBox Color within the Windows Programming forums, part of the Platform Specific Boards category; Anyone know how to change the background color in a ComboBox? I'm doing MFC programming using MSVC++ 6.0. From what ...

  1. #1
    John S.
    Guest

    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.
    Thanks
    John

  2. #2
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    Posts
    133
    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
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    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.
    zen

  4. #4
    John S.
    Guest

    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, 07:23 PM
  2. egavga.bgi problem
    By sunil21 in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 09-22-2003, 06:06 PM
  3. My opinion on skin color
    By Leeman_s in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 07-11-2003, 01:12 PM
  4. console text color change in MSVC?
    By revelation437 in forum C++ Programming
    Replies: 1
    Last Post: 05-16-2003, 02:46 PM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM

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