Manually implement LVSCW_AUTOSIZE_USEHEADER
-
Hello, I'm interested in the process behind the LVSCW_AUTOSIZE_USEHEADER used to set the width of the header control of a CListCtrl. Does anybody know how they calculate the exact width of the text. This is based of the font used. What is I want to write this myself? m_cListCtrl.SetColumnWidth(i, CString("This is Column1).GetLength()) gives me the length of the string (15 points), but what I think I need to do is multiply this length by the average length (in points) of the characters used in the string. Let's say a character average width is 6 points, my header will be 15 (=GetLength)*6, which is a reasonable width for the header. Anybody knows of such a function. Or how I really should tackle this? Thanks in advance Wim
-
Hello, I'm interested in the process behind the LVSCW_AUTOSIZE_USEHEADER used to set the width of the header control of a CListCtrl. Does anybody know how they calculate the exact width of the text. This is based of the font used. What is I want to write this myself? m_cListCtrl.SetColumnWidth(i, CString("This is Column1).GetLength()) gives me the length of the string (15 points), but what I think I need to do is multiply this length by the average length (in points) of the characters used in the string. Let's say a character average width is 6 points, my header will be 15 (=GetLength)*6, which is a reasonable width for the header. Anybody knows of such a function. Or how I really should tackle this? Thanks in advance Wim
Wim Jans wrote: Does anybody know how they calculate the exact width of the text.
CListCtrl::GetStringWidth()
would be one way.
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
Wim Jans wrote: Does anybody know how they calculate the exact width of the text.
CListCtrl::GetStringWidth()
would be one way.
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?