Click to See Complete Forum and Search --> : Coloring readonly edit control


May 17th, 1999, 12:56 AM
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

merre
May 17th, 1999, 02:47 PM
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.

May 18th, 1999, 02:13 AM
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