So colorful!

This is a discussion on So colorful! within the Windows Programming forums, part of the Platform Specific Boards category; Just wondering - is it possible to use colored text in an edit box? If not, can it be hardcoded? ...

  1. #1
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949

    Talking So colorful!

    Just wondering - is it possible to use colored text in an edit box? If not, can it be hardcoded? Thanks !
    Do not make direct eye contact with me.

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Handle the WM_CTLCOLOREDIT message.

    wParam: handle to the device context for the edit control window.

    lParam: handle to the edit control.

    Example
    Code:
    case WM_CTLCOLOREDIT: 
    {
      HDC dc = (HDC)wParam ;
    
      SetTextColor( dc, RGB(255,0,0) ) ;  // red text
    
      SetBkMode( dc, TRANSPARENT) ;    // choose our own bkgrnd
    
      return (int)(HBRUSH)GetStockObject(GRAY_BRUSH) ;  // gray
    }
    Last edited by Dante Shamest; 05-28-2003 at 08:12 AM.

  3. #3
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Does this go in WM_COMMAND, WM_CREATE, and in the MDIWndProc, or the Wnd Proc
    Do not make direct eye contact with me.

  4. #4
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    WndProc.

  5. #5
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Can you have more than one color in the same edit box? If not, can it be hardcoded ? Thanks again !
    Do not make direct eye contact with me.

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    No.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Not unless you're using Rich Edits or owner-drawing the edit boxes.

  8. #8
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Originally posted by Dante Shamest
    Not unless you're using Rich Edits or owner-drawing the edit boxes.
    Simply put....what? Sorry for my ignorance!
    Do not make direct eye contact with me.

  9. #9
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Rich Edits are a more advanced version of normal edit controls.

    Owner drawing refers to completely handling the drawing of your edit box.

    You'll have to search MSDN for more documentation and information on them.
    Last edited by Dante Shamest; 05-29-2003 at 09:41 PM.

  10. #10
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Ah - thanks !
    Do not make direct eye contact with me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Colorful pictures in Dos
    By Blizzarddog in forum Game Programming
    Replies: 6
    Last Post: 02-24-2003, 08:35 AM
  2. Colorful printf...
    By Trai_K in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 04-28-2002, 09:40 AM
  3. colorful rich text edit boxes
    By master5001 in forum Windows Programming
    Replies: 0
    Last Post: 11-26-2001, 10:52 AM

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