
Column Width in List mode (Listview control)
Cheers but I'm still getting very weird results. I only want to work in the
"List" view of the control therefore only use one column.
Some times the columns are bigger than other times. Words are "..." even
though they should easily fit in the column.
I tried the Code but that still does not work.
I have a routine that displays a set of alphabetical buttons and once
pressed it displays a set of key words starting with that letter.
I clear the list and repopulate it again. Using the code below, it kills
this process, nothing is displayed. after another selected button.
As I said weird.
Using the columnheader(x).width does nothing. I get the same 1440 value
even when the column widths are visbibly quite different.
So can anyone help.
Private Sub lvwAutosizeItems(lvw As ListView)
'Size each column based on the width
'of the widest list item in the column.
'If the items are shorter than the column
'header text, the header text is truncated.
'You may need to lengthen column header
'captions to see this effect.
Dim col2adjust As Long
For col2adjust = 0 To lvw.ColumnHeaders.Count - 1
Call SendMessage(lvw.hwnd, _
LVM_SETCOLUMNWIDTH, _
col2adjust, _
ByVal LVSCW_AUTOSIZE)
Next
End Sub
Quote:
> With the Listview control how can you change the width of the column in
the
> list view.
> I build the list from a db and use the following code
> lvwAvailable.Listitems.clear
> While Not objRStemp.EOF
> sKeyword = objRStemp.Fields(0).Value
> Set lix = lvwAvailable.ListItems.Add(, sKeyword, sKeyword)
> lix.ToolTipText = sKeyword
> objRStemp.MoveNext
> Wend
> I have tried everything but the default size remains.
> Can anyone help?
> Cheers
> Ric Pullen