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

Thread: Edit Box color

  1. #1
    Join Date
    Jan 2005
    Posts
    317

    Cool Edit Box color

    Hi All,

    Does anyone know of any way to change the background white color of Edit Box, and color of its text ?

    Any idea will be great.

    naim1

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Edit Box color

    Yes. Handle the WM_CTLCOLOR and change the colors that you want. There is an example in MSDN on the page for WM_CTLCOLOR (Handling Reflected Messages: An Example of a Reusable control).
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Oct 2000
    Location
    India
    Posts
    4,620

    Thumbs up Re: Edit Box color

    Hi,

    Handle WM_CTLCOLOR and in your OnCtlColor(CDC* pDC, UINT nCtlColor)
    function, use
    Code:
       //set text color
       pDC->SetTextColor(RGB(255,255,255));
       //set the text's background color
       pDC->SetBkColor(RGB(0,0,0));
    Oops. Cilu got ahead of me
    All luck and have a great day.

    Regards,
    V.Girish

    Visit www.geocities.com/contactgirish for Source code, Tutorials, FAQs and Downloads.

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Edit Box color

    naim, please don't create multiple threads with the same question
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  5. #5
    Join Date
    May 2005
    Posts
    4,954

    Re: Edit Box color

    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

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