CListCtrl Column width
-
I've a CLIstCtrl with the Owner data style. It works great, but when I try to use SetColumnWidth(LVSCW_AUTOSIZE), it resizes the columns in a wrong way, because it considers only visible elements. So I decided to detemine the max length; I tryed using either CDC::GetOutputTextExtent than CListCtrl::GetStringWidth, but both ignore the space between the column border and the text, and I can't figure howto determine the size of that... I tryed using GetSystemMetrics with SM_CXFIXEDFRAME and SM_CXEDGE, but they seem to be wrong. Any ideat? thanks
-
I've a CLIstCtrl with the Owner data style. It works great, but when I try to use SetColumnWidth(LVSCW_AUTOSIZE), it resizes the columns in a wrong way, because it considers only visible elements. So I decided to detemine the max length; I tryed using either CDC::GetOutputTextExtent than CListCtrl::GetStringWidth, but both ignore the space between the column border and the text, and I can't figure howto determine the size of that... I tryed using GetSystemMetrics with SM_CXFIXEDFRAME and SM_CXEDGE, but they seem to be wrong. Any ideat? thanks
To determine the width/height of the scrollbars, use SM_CXVSCROLL/SM_CYVSCROLL as parameters.
-
To determine the width/height of the scrollbars, use SM_CXVSCROLL/SM_CYVSCROLL as parameters.
Thanks, but it's not what I nedd... The control (in report mode) has many column; any column has: border (if it is visible or not depend on styles selected) space text space border. I need to find the size of that spaces...
-
I've a CLIstCtrl with the Owner data style. It works great, but when I try to use SetColumnWidth(LVSCW_AUTOSIZE), it resizes the columns in a wrong way, because it considers only visible elements. So I decided to detemine the max length; I tryed using either CDC::GetOutputTextExtent than CListCtrl::GetStringWidth, but both ignore the space between the column border and the text, and I can't figure howto determine the size of that... I tryed using GetSystemMetrics with SM_CXFIXEDFRAME and SM_CXEDGE, but they seem to be wrong. Any ideat? thanks
You could give the column header a fixed size and use LVSCW_AUTOSIZE_USEHEADER instead of LVSCW_AUTOSIZE. Anyway, you can get the longest string in the column, so just set the column width to this string width + a few pixels ? Or didn't I get the thing ? ~RaGE();
-
You could give the column header a fixed size and use LVSCW_AUTOSIZE_USEHEADER instead of LVSCW_AUTOSIZE. Anyway, you can get the longest string in the column, so just set the column width to this string width + a few pixels ? Or didn't I get the thing ? ~RaGE();
Using LVSCW_AUTOSIZE_USEHEADER has the same problem than using LVSCW_AUTOSIZE: if a non-visible string is longer than the header it isn't considered. Yes, what i'm doing il looking for the longest text extent (not the longest string, "w" is larger than "ll") and adding some pixel. But I would like to know how much should be "some pixel"... I think it depends on system font & some other param..