mattKnight
Programmer
I have a routine to resize the width of the columns in a listview control (.view = lvwReport).
My problem is that when it runs the columns resize, but I get a horizontal scroll bar. What I want is the columns to fit the available width exactly! ( no scrolling etc)
Results from running (cut & pasted from immediate window)
and as a final observation, if I remove the Cint() from the system , the results are unchanged.
I seems to me to be some obscure (ish) rounding / conversion issue between integer and single.
Does anyone have an idea of a work around or fix? my Platform is W2k SP3, vb6 sp5 and I am using the version of the control shipped with SP4 (latest revision shown on my machine).
All help gratefully received
Take Care
Matt
If at first you don't succeed, skydiving is not for you.
My problem is that when it runs the columns resize, but I get a horizontal scroll bar. What I want is the columns to fit the available width exactly! ( no scrolling etc)
Code:
Dim sngWidth As Single
Dim intCol As Integer
Dim sngUsedWidth As Single
Dim sngLastcol As Single
sngWidth = lvwEnds.Width
With lvwEnds.ColumnHeaders
intCol = CInt(sngWidth / 8)
.Item("EndName").Width = CInt(intCol * 3)
Debug.Print CInt(intCol * 3); " "; .Item("EndName").Width
sngUsedWidth = sngUsedWidth + .Item("EndName").Width
.Item("Thread").Width = CInt(intCol * 2)
Debug.Print CInt(intCol * 2); " "; .Item("Thread").Width
sngUsedWidth = sngUsedWidth + .Item("Thread").Width
.Item("Material").Width = CInt(intCol * 2)
Debug.Print CInt(intCol * 2); " "; .Item("Material").Width
sngUsedWidth = sngUsedWidth + .Item("Material").Width
sngLastcol = sngWidth - sngUsedWidth
.Item("Revision").Width = sngLastcol
Debug.Print sngLastcol; " "; .Item("Revision").Width
Debug.Print lvwEnds.Width; " "; sngUsedWidth + .Item("Revision").Width
End With
Results from running (cut & pasted from immediate window)
Code:
1986 1985.953
1324 1323.78
1324 1323.78
661.4883 661.6063
5295 5295.118
and as a final observation, if I remove the Cint() from the system , the results are unchanged.
I seems to me to be some obscure (ish) rounding / conversion issue between integer and single.
Does anyone have an idea of a work around or fix? my Platform is W2k SP3, vb6 sp5 and I am using the version of the control shipped with SP4 (latest revision shown on my machine).
All help gratefully received
Take Care
Matt
If at first you don't succeed, skydiving is not for you.