Paint the CEdit

I need to paint a CEdit control during
execution of the program.

I tried using SetBackColor but it didnt compile. Some one said that I have to be able to catch messages. If this is
the case than I need someone to help me please. A working piece of code is appreciated
VirtualRealityAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vinayak KumbarSr Program ManagerCommented:
Hi,

I suppose that edit box is in a dialog box say CMyDlg
Then map OnInitDialog() and OnCtlColor() function to that dialog. Declare m_MyBrush as CBrush in doalog.h file

and put the following code

In OnInitDialog()

m_MyBrush.CreateSolidBrush(RGB(255,0,0));

and in OnCtlColor()
if(nCtlColor == CTLCOLOR_EDIT)
{
    return m_MyBrush;
}

Hope that helps
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.