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.
Printable View
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.
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()
Good luck..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);
}
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..
exactly how do i create cBrush object ??
Thx.
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...
YepQuote:
Originally posted by Quell
exactly how do i create cBrush object ??
Thx.
just curious.....wats that yep for???:confused:Quote:
Originally posted by aventec_01
Yep
so sory as i hav just changed my contact lens and i dint see de word how infront of de statement:DQuote:
Originally posted by Joseph_R_Thomas
just curious.....wats that yep for???:confused:
Did you solve the problem ? I will go search for you if you need...:)Quote:
Originally posted by Quell
exactly how do i create cBrush object ??
Thx.
Regards,
i doonno how to make a CBrush object...what is the solution ? I tried google...didn't come up with much.......
Thx in Advance
Code:COLORREF Color;
CBrush Brush;
Color = RGB(255, 0, 0);
Brush.CreateSolidBrush(Color);