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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Background color 1

Status
Not open for further replies.

branko

Programmer
Mar 19, 2002
49
0
0
SI
Hi,
I am new to C++ and MFC.
Three weeks ago I started and I am -slowly- making progress. At my job I have to make adjustments to an existing project.
Sometimes browsing MSDN and internet and hardcopies doesn't give a solution to my -many- questions. Like today; More than 3 hours I am trying to change the background color of a CScrollView class. I tried SetBkColor (in OnDraw) and things like overriding OnCtlColor. No change of color can be detected. If I check with GetBkColor, I can see my desired color is set.
Does anybody have any suggestions?
Thanks in advance,

Branko
 
Did you try re-drawing the window upon changing the color?

Hope this helps, Rob
"Programming is like art...It makes me feel like chopping my ear off."

- Currently down
 
I used SetBkColor in OnDraw of CScrollView.
Somehow this doesn't seem to me the best spot to redraw the window.
Should I also override OnCtlColor?

branko
 
SetBkColor is used to set the color behind characters that you paint with functions such as TextOut. You need to create a brush with the color of your choosing and paint the view in OnEraseBkgrnd with something like FillRect.
Hope this helps [dazed]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top