Set Text bold in edit control
-
Hiii all, I need to make text bold in a read only edit control .Can u suggest me how to do this Thanks
-
Hiii all, I need to make text bold in a read only edit control .Can u suggest me how to do this Thanks
Try this
CFont font;
VERIFY(font.CreateFont(
12, // 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
"Arial")); // lpszFacenamem_cEdit.SetFont(&font); //Object of the Edit Control
VIBIN "Fool's run away,where angle's fear to tread"
-
Try this
CFont font;
VERIFY(font.CreateFont(
12, // 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
"Arial")); // lpszFacenamem_cEdit.SetFont(&font); //Object of the Edit Control
VIBIN "Fool's run away,where angle's fear to tread"
vibindia wrote:
FW_NORMAL, // nWeight
You want to say
FW_BOLD
, isn't it?
Prasad MS MVP - VC++
-
Try this
CFont font;
VERIFY(font.CreateFont(
12, // 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
"Arial")); // lpszFacenamem_cEdit.SetFont(&font); //Object of the Edit Control
VIBIN "Fool's run away,where angle's fear to tread"
Thanks for the suggestion..... Here i want to change the font to bold only... other settings remaining the same.to use this i have to set all other parameters for which i donno the previous set values... when i use this size of text .. and all other settings r getting changed... how can i overcome this..
-
vibindia wrote:
FW_NORMAL, // nWeight
You want to say
FW_BOLD
, isn't it?
Prasad MS MVP - VC++
ya in nWeight the Boldness has to be given
Constant Value
FW_DONTCARE 0
FW_THIN 100
FW_EXTRALIGHT 200
FW_ULTRALIGHT 200
FW_LIGHT 300
FW_NORMAL 400
FW_REGULAR 400
FW_MEDIUM 500
FW_SEMIBOLD 600
FW_DEMIBOLD 600
FW_BOLD 700
FW_EXTRABOLD 800
FW_ULTRABOLD 800
FW_BLACK 900
FW_HEAVY 900VIBIN "Fool's run away,where angle's fear to tread"
-
ya in nWeight the Boldness has to be given
Constant Value
FW_DONTCARE 0
FW_THIN 100
FW_EXTRALIGHT 200
FW_ULTRALIGHT 200
FW_LIGHT 300
FW_NORMAL 400
FW_REGULAR 400
FW_MEDIUM 500
FW_SEMIBOLD 600
FW_DEMIBOLD 600
FW_BOLD 700
FW_EXTRABOLD 800
FW_ULTRABOLD 800
FW_BLACK 900
FW_HEAVY 900VIBIN "Fool's run away,where angle's fear to tread"
FW_BOLD in place of FW_NORMAL will do. Why would you suggest FW_NORMAL for some who wants to render bold text? :rolleyes:
found at bash.org [kernx]|.|.|.|.|.|.|.| [kernx]sorry, wrong window [beox33]say me why in the f*ck will you type that in any window
-
Thanks for the suggestion..... Here i want to change the font to bold only... other settings remaining the same.to use this i have to set all other parameters for which i donno the previous set values... when i use this size of text .. and all other settings r getting changed... how can i overcome this..
You can get current font from dialog, and then modify it to bold. Refer follwoing snippet,
CFont* ptemp = GetFont();
LOGFONT lf;
ptemp->GetLogFont(&lf);
lf.lfWeight = FW_BOLD;
CFont Temp1;
Temp1.CreateFontIndirect(&lf);
SetFont(&Temp1);
Prasad MS MVP - VC++
-
FW_BOLD in place of FW_NORMAL will do. Why would you suggest FW_NORMAL for some who wants to render bold text? :rolleyes:
found at bash.org [kernx]|.|.|.|.|.|.|.| [kernx]sorry, wrong window [beox33]say me why in the f*ck will you type that in any window
brahmma wrote:
Why would you suggest FW_NORMAL for some who wants to render bold text?
Yet another example of "failing to fully read the question."
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne