Changing text of a static control as BOLD
-
Hi all, I have made a static text box in my application. i want to make the text of that static dialog box as BOLD. I dont want to change the font just want to make it as bold.... How could i do so.... Thanks in advance
-
Hi all, I have made a static text box in my application. i want to make the text of that static dialog box as BOLD. I dont want to change the font just want to make it as bold.... How could i do so.... Thanks in advance
Add a control variable to your static control (
m_static
here) and add a CFont member to your class (myFont
here). You could then apply the bold style to the font in your control like this:CFont *font = m_static.GetFont();
LOGFONT lf;
font->GetLogFont(&lf);
lf.lfWeight = FW_BOLD;
myFont.CreateFontIndirect(&lf);
m_static.SetFont(&myFont);Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Add a control variable to your static control (
m_static
here) and add a CFont member to your class (myFont
here). You could then apply the bold style to the font in your control like this:CFont *font = m_static.GetFont();
LOGFONT lf;
font->GetLogFont(&lf);
lf.lfWeight = FW_BOLD;
myFont.CreateFontIndirect(&lf);
m_static.SetFont(&myFont);Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
I am unable to get which type of variable is myFont
-
I am unable to get which type of variable is myFont
it's a
CFont
, I suppose. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
I am unable to get which type of variable is myFont
I said it in my previous reply[^] to you:
Rajesh R Subramanian wrote:
and add a CFont member to your class (myFont here).
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
it's a
CFont
, I suppose. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeI suppose she's going to declare the font object to be function local. :)
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
I suppose she's going to declare the font object to be function local. :)
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
From my (Italian) point of view your most challenging supposition is about OP gender. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
From my (Italian) point of view your most challenging supposition is about OP gender. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeNeha = Indian lady name. :)
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Neha = Indian lady name. :)
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
I supposed! :laugh:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
I am unable to get which type of variable is myFont
Also, please make sure that you do NOT have that CFont object (myFont) declared in a local function, but instead as a member of your class. This is to prevent the font object from going out of scope prematurely. :)
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Hi all, I have made a static text box in my application. i want to make the text of that static dialog box as BOLD. I dont want to change the font just want to make it as bold.... How could i do so.... Thanks in advance
There's an example in the Extras section of this article.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne