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

    Coloring readonly edit control

    Hello,
    I wanted to change the background color of the "Read Only" Edit control.
    I have tried overriding the "OnCtlColor" but in vain. :-(

    Please help me out. Any valuable suggestion is very much appreciated.
    -Annie



  2. #2
    Join Date
    Apr 1999
    Posts
    12

    Re: Coloring readonly edit control

    hi!
    your OnCtlColor have to be like this:

    CBrush m_color;
    HBRUSH (name of your project)::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

    return m_color;
    }

    and you have to do one more thing . in your OnInitDialog() you have to put this funktion:

    m_color.CreateSolidBrush(RGB(50, 45, 243));

    i hope that works.


  3. #3
    Guest

    Re: Coloring readonly edit control

    Thanks for the reply. I had posted the same query under "beginner" category
    under the subject title "Save me" posted on 5/17. Got answers there
    and the thing is now up and working.

    -Thank u all once again,
    -Annie


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