|
-
September 5th, 2003, 03:13 PM
#1
Static Text color
Hello.
Since i am, newb i donno hwo to do it...adn books don't show this....i coudln't find it on thw web..can somone tell me how to change color in static text ?adn font hopefully.....for each static text.
-
September 5th, 2003, 03:27 PM
#2
Create a CBrush object and intialize it in the OnInitDialog function.
Override the ON_WM_CTLCOLOR() message for your dialog in the class wizard.
Now go to the function labeled OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
Now switch through pWnd->GetDlgCtrlID()
Code:
switch (pWnd->GetDlgCtrlID())
{
case IDC_EDIT1:
case IDC_EDIT2:
case IDC_EDIT3:
case IDC_EDIT4:
case IDC_EDIT5:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,0,255)); // change the text color
hbr = (HBRUSH) m_brushBG; // apply the brush
break;
// otherwise, do default handling of OnCtlColor
default:
hbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
}
Good luck..
-
September 5th, 2003, 03:30 PM
#3
In general this is done by reacting on the WM_CTLCOLOR message. Override the associated message handler 'OnCtlColor()' and check for CTLCOLOR_STATIC. There you can change the color appearance of your static controls.
However, this is a global option. Changing the color the above way would result in all static controls being the same color. Therefore you should subclass the static control and then use message reflection to color it individually.
However, there exists several color static controls already like this one..
-
September 5th, 2003, 08:49 PM
#4
exactly how do i create cBrush object ??
Thx.
-
September 5th, 2003, 09:17 PM
#5
go to the link given by Mr.Masur...above,,,
take a look in the source code....
everything is there.!!
it will teach you how to draw the brush....
and will help you with a lot of other stuff...
R. Thomas
"Be anxious for nothing, but in everything by prayer and supplication, with thanksgiving, let your requests be made know to God; and the peace of God, which surpasses all understanding, will guard your hearts and minds through Christ Jesus."Philippians 4:6-7
"Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
-
September 5th, 2003, 10:04 PM
#6
Originally posted by Quell
exactly how do i create cBrush object ??
Thx.
Yep
-
September 5th, 2003, 10:12 PM
#7
Originally posted by aventec_01
Yep
just curious.....wats that yep for???
R. Thomas
"Be anxious for nothing, but in everything by prayer and supplication, with thanksgiving, let your requests be made know to God; and the peace of God, which surpasses all understanding, will guard your hearts and minds through Christ Jesus."Philippians 4:6-7
"Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
-
September 6th, 2003, 05:25 AM
#8
Originally posted by Joseph_R_Thomas
just curious.....wats that yep for???
so sory as i hav just changed my contact lens and i dint see de word how infront of de statement
-
September 7th, 2003, 04:33 AM
#9
Originally posted by Quell
exactly how do i create cBrush object ??
Thx.
Did you solve the problem ? I will go search for you if you need...
Regards,
-
September 7th, 2003, 07:55 AM
#10
i doonno how to make a CBrush object...what is the solution ? I tried google...didn't come up with much.......
Thx in Advance
-
September 7th, 2003, 10:02 AM
#11
Code:
COLORREF Color;
CBrush Brush;
Color = RGB(255, 0, 0);
Brush.CreateSolidBrush(Color);
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
|