Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Used to change the width of a column in report view or the width of all columns in list-view mode. You can use this macro or send the LVM_SETCOLUMNWIDTH message explicitly.
BOOL ListView_SetColumnWidth(
HWND hwnd,
int iCol,
int cx
);
hwnd
Type: HWND
A handle to the list-view control.
iCol
Type: int
The zero-based index of a valid column. For list-view mode, this parameter must be set to zero.
cx
Type: int
The new width of the column, in pixels. For report-view mode, the following special values are supported:
Type: BOOL
Returns TRUE if successful, or FALSE otherwise.
Assume that you have a 2-column list-view control with a width of 500 pixels. If the width of column zero is set to 200 pixels, and you make the following call.
ListView_SetColumnWidth(hwnd, 1, LVSCW_AUTOSIZE_USEHEADER)
The second (and last) column will be 300 pixels wide.
Note that ListView_SetColumnWidth converts the cx parameter to a 16-bit value.
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | commctrl.h |