|
-
September 12th, 2009, 07:06 AM
#1
quick question about changing background colour
Hi All.
I would like to change the BK colour of a CStatic object on my Dialog window.
Is this possible without deriving my own CStatic class and changing the painting method?
Also, how would I centre justify text within the CStatic object??
Many Thanks
Phill
-
September 12th, 2009, 09:00 AM
#2
Re: quick question about changing background colour
1. See the axample in MSDN article CWnd::OnCtlColor
2. Using SS_CENTER style?
Victor Nijegorodov
-
September 12th, 2009, 11:24 AM
#3
Re: quick question about changing background colour
Hi Victor
Thanks for the reply.. and that would certainty do the job. However, for reasons best known to myself, I have an array of pointers to my CStatics from which I have created my objects, and I only want to change the BKColour of some of them.
Would identifying the correct object within the OnCtlColor message handler be a problem since I dont know the ID?
I have tried to change the colour at the point of creation by getting the CStatics CWnd CDC and using that to change the colour without success. Maybe Im being thick, but I cant see why that should'n work.
Thanks again
Phill
-
September 12th, 2009, 11:42 AM
#4
Re: quick question about changing background colour
Replace this line:
Code:
if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)
with something like:
Code:
if (pWnd == m_pStatic1 || pWnd == m_pStatic3 || ...)
where m_pStatic1, m_pStatic3, ... - your "pointers to CStatics" which should have another bk-color
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|