Changing Text/Background colours for window controls ...

This is a discussion on Changing Text/Background colours for window controls ... within the Windows Programming forums, part of the Platform Specific Boards category; I'm making class wrappers for various window controls such as edit, static, progress etc. Similar in a way to the ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    20

    Changing Text/Background colours for window controls ...

    I'm making class wrappers for various window controls such as edit, static, progress etc. Similar in a way to the CEdit class etc - but much simplified.

    I've subclassed the winprocs in class wrappers, no problem. But I can't get the text/background colours to change.

    The MSDN says that you must intercept WM_CTLCOLOREDIT etc in the parent winproc in order to set the colours ... but I need to keep each window control completely self contained.

    Therefore, is there another way to change the colours of such controls, without doing so from the parent winproc?

    I'm using straight C++ (no MFC)

    Regards
    Mark

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    If you have subclassed the controls then handle their WM_ERASEBKGND messages and paint their backgrounds yourself. Alternatively you can use a similar mechanism to that employed by mfc with the over-vaunted and disengenuous label of 'message reflection' - which is simply sending the details of the WM_CTL* messages to your c++ class wrapper (or c fn) for handling.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing colours
    By 250co in forum C Programming
    Replies: 2
    Last Post: 05-12-2006, 01:06 AM
  2. Colours of text/background?
    By jonnyfb in forum C++ Programming
    Replies: 4
    Last Post: 04-05-2006, 05:21 AM
  3. Changing the color of controls
    By X PaYnE X in forum Windows Programming
    Replies: 1
    Last Post: 01-21-2004, 01:30 PM
  4. Changing control's font
    By Devil Panther in forum Windows Programming
    Replies: 1
    Last Post: 05-31-2003, 06:41 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

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