CTreeCtrl font size
-
Hi Everyone How do you increase the font size of the text in CTreeCtrl? thanks
-
Hi Everyone How do you increase the font size of the text in CTreeCtrl? thanks
You need to set a new font for the control. Normally I would do it something like this (assuming your control is part of a dialog)
OnInitDialog()
{
LOGFONT lf;m_TreeCtrl.GetFont()->GetLogFOnt(&lf):
lf.lfHeight += 2; // make font larger (check for -ve)
m_Font.CreateFontIndirect(&lf);
m_TreeCtrl.SetFont(&m_Font);
}m_Font needs to be part of your dialog class as it needs to live at least as long as the tree control using it. After setting the font, the tree control should work quite happily with it. Roger Allen Sonork 100.10016 Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
-
You need to set a new font for the control. Normally I would do it something like this (assuming your control is part of a dialog)
OnInitDialog()
{
LOGFONT lf;m_TreeCtrl.GetFont()->GetLogFOnt(&lf):
lf.lfHeight += 2; // make font larger (check for -ve)
m_Font.CreateFontIndirect(&lf);
m_TreeCtrl.SetFont(&m_Font);
}m_Font needs to be part of your dialog class as it needs to live at least as long as the tree control using it. After setting the font, the tree control should work quite happily with it. Roger Allen Sonork 100.10016 Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003