CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Dec 2003
    Posts
    3

    Question Change Edit Control Color Directly?

    Howdy Y'all,

    Instead of changing an Edit Control's background and text color by responding to the WM_CTLCOLOR message, I tried to do the following:

    Code:
    m_hEditBox = CreateWindow("EDIT",NULL,WS_CHILD|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN,
    100,100,100,100, (HMENU) 1, NULL, NULL);
    		
    HDC editBoxDC = GetDC(m_hEditBox);
    		
    SetBkMode(editBoxDC, TRANSPARENT);
    SetBkColor(editBoxDC, RGB(255,255,0));
    SetTextColor(editBoxDC, RGB(0,0,255));
    ShowWindow(m_hEditBox,SW_SHOW);		
    ReleaseDC(m_hEditBox, editBoxDC);
    ...While the edit control appears in the appropriate location, the background and text colors are unchanged. Any idea what I'm doing wrong?

    -TM
    Last edited by Tzalmaves; December 2nd, 2003 at 11:49 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured