hi
i had a problem in static text VC++
how to change font in static text (VC++)
i want to modif only one static text. not overall.
thanks.
Printable View
hi
i had a problem in static text VC++
how to change font in static text (VC++)
i want to modif only one static text. not overall.
thanks.
SetFont() is the function you need.Quote:
Originally Posted by syrhackman
sorry,
can u give me an example..
i want to change my static text with ID : ID_STATIC1
thanks.
If this helps . do not forget to Rate This Post. Thx.Code:CFont m_Font;
m_Font.Detach();
m_Font.CreateFont(-13, 0, 0, 0, FW_NORMAL, FALSE, FALSE,0,0,0,0,0,0, "Tahoma");
GetDlgItem(IDC_STATIC1)->SetFont(&m_Font);
Add a control variable link to your static text. For example, m_Test.
Then you can add in the similar code in your initialisation.
Perhaps, there might be some easy way to do it.Code:CFont font;
font.CreateFontW(20, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
_T("Arial")); // lpszFacename
m_Test.SetFont(&font,TRUE);
Thanks...
It works..
Thanks alot..
You are welcome . :thumb: ;)
To zawther :
how to set ur m_Test to Static Control ????
See this FAQ: How to set the font of a control.
As zawthet explained: By creating a DDX member variable of type CStatic for the control - you usually do this with ClassWizard.Quote:
Originally Posted by sunny_sz
Yeah . :thumb: :)