This is a discussion on SetTextColor? within the Windows Programming forums, part of the Platform Specific Boards category; I need the whole background one color...

  1. #16
    Programming is fun, mkay?
    Join Date
    Oct 2001

    Unhappy I need...

    I need the whole background one color


    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #17
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Yes, you paint the background with a HBRUSH, and text background with SetBkColor().

  3. #18
    train spotter
    Join Date
    Aug 2001
    near a computer

    Owner Draw Listbox

    Or you use an owner draw listbox and write a paint function for it. Harder to do but much more control. Different columns / rows / items can have different colours / fonts ect.

    Calling the paint function in response to a WM_DRAWITEM msg.

    case WM_DRAWITEM:
    pDrawItem = (DRAWITEMSTRUCT *)lParam;
    In the ListBoxRepaint function;
    Find the text with LVM_GETITEMTEXT and SendMessage()
    Find the column widths with LVM_GETCOLUMNWIDTH and so find the column's client rectangle.
    Work out where you want the text with GetTextExtentPoint32() and so the text's client rectangle.
    FrameRect() and FillRect() to colour in as well as SetBkColour() and SetTextColour().
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #19
    I have described the procedure here (with a little example in C)


Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SetTextColor question
    By Tropicalia in forum Windows Programming
    Replies: 3
    Last Post: 10-12-2006, 07:58 AM
  2. Problems with SetTextColor()
    By Tronic in forum Windows Programming
    Replies: 2
    Last Post: 05-15-2004, 11:30 PM

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