
List View Width and Scroll Question
Andy ... If you want that single-columned report-style listview to
automagically assume the full width of the control, call this from some
logical place....
Const LVSCW_AUTOSIZE_USEHEADER = -2
Call SendMessage(ListView1.hwnd, _
LVM_SETCOLUMNWIDTH, _
0, _
ByVal LVSCW_AUTOSIZE_USEHEADER)
If you add more columns, use this instead ...
Const LVSCW_AUTOSIZE_USEHEADER = -2
Dim col2adjust As Long
For col2adjust = 0 To ListView1.ColumnHeaders.Count - 1
Call SendMessage(ListView1.hwnd, _
LVM_SETCOLUMNWIDTH, _
col2adjust, _
ByVal LVSCW_AUTOSIZE_USEHEADER)
Next
--
Randy Birch, MVP Visual Basic
http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/
| Thanks, changing the style setting to Report and then adjusting the
| columnheadings width sorted it.
|
| I didn't think the Listbox could do check boxes and multi select at the
same
| time... I'm sure there was a reason why I had to use listview instead.
|
| Thanks
| Andy Nield
|
| > Andy,
| >
| > >What I need is a single column list, with a check boxes, multi-select,
| and
| > >scrolling vertically...
| >
| > So why not use a Listbox then? It can do all that, with the help from
| > this code:
| >
| > Displaying the Horizontal Scroll Bar in a ListBox
| > http://www.mvps.org/vbnet/code/listapi/sethorizontalextent.htm
| >
| >
| > >2) When the list is full (vertically) it puts new items to the right of
| the
| > >top item and uses a horizontal scroll bar instead of adding items
| underneath
| > >and using a vertical scroll bar...
| >
| > Set the style to Report instead of List.
| >
| >
| > Mattias
| >
| > __________________________________________________
| > VB+ http://hem.spray.se/mattias.sjogren/
| > Please send questions/replies to the newsgroups
|
|