I've come through some auto column (ColumnHeader
) widths on WinForms ListView
control.
Width = -1
sets auto-width based on content width and -2 sets based on header and content.
However I cannot find any way to get the auto-computed width which is then set by -1/-2.
Width property of ColumnHeader
items returns -1.
Is there any way to obtain the real width in pixels which was auto-computed by setting the property to -1/-2?
Thank you!
ColumnHeader.Width
property right after assigning the-1
or-2
values. It will return the real width. – dr.null 2 days agoColumnHeader.AutoResize()
method to set the size mode, the meaning is much more clear. TheWidth
property of the ColumnHeader always returns the value set in the native Control (viaSendMessage -> LVM_GETCOLUMNWIDTH
): it always returns the size in pixels. – Jimi yesterday20 - 1 = 19
. Double check what you are doing and read carefully the second comment. – dr.null yesterday