This code prevents the specified column(s) of a ListView control from being resized by the user. It does that by subclassing the ListView control and watching for the HDN_BEGINTRACK and HDN_DIVIDERDBLCLICK notification codes. Additionally, it also provides appropriate feedback to the user by displaying the "Unavailable" cursor when the mouse is over the locked column divider. That is done by subclassing the ListView's Header control and handling the WM_SETCURSOR message.
The modLockLVCols.bas file in the attached project below has been inspired by the codes in the following threads:
Preventing certain Listview columns from sizing...
[RESOLVED] Prevent User From Resizing Column Width in ListView
Also included in the attachment is frmLockLVColsDemo.frm:
![Name: Lock ListView Columns.png
Views: 128
Size: 14.0 KB]()
The modLockLVCols.bas file in the attached project below has been inspired by the codes in the following threads:
Preventing certain Listview columns from sizing...
[RESOLVED] Prevent User From Resizing Column Width in ListView
Also included in the attachment is frmLockLVColsDemo.frm: