Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Some good info for OnCtlColor()

Status
Not open for further replies.

Valius

Programmer
Oct 20, 2000
174
US
I was having some BIG problems with this function and I think I found out what was going on and I want to share what I found with you guys. When you use the functions

pDC->SetBkColor()
or pDC->SetTextColor()

, it ONLY changes the text, not the actual control. When I was doing this, I was getting a control with a white background but I could get the correct color of the text and when I typed, the text background would be the correct color. To make the actual CONTROL's (such as an edit box) background change, you use this

hbr = CreateSolidBrush().

This will allow you to change the controls background. You can also use

hbr = CreatePatternBrush()

to display a .bmp in the background. So depending on what control comes up (use nCtlColor or pWnd->GetDlgCtrlID() to determine the control), you can set the colors how you want. If anyone needs help on this I'd be more than happy to help....believe me, I've spend many hours trying to figgure this out!

Niky Williams
NTS Marketing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top