|
Microsoft Office Application Development
|
|
Showing An Array On A Form; Autosizing ColumnWidths Of A ListBoxHow The Resize Works
Various people have devised a trick to calculate the column widths. Some use
constants, which which the number of characters to be displayed is multiplied.
This trick doesn't work reliably since screen resolution and Font may affect
this.
The trick to make the resizing work lies in the
Function SetWidths behind the userform (as shown on the
previous page). I pass an array of
character counts to the function (containing the maximum # of characters for
each column to be shown in the listbox). Then for each column I change the
caption of the label to an equal amount of characters as the value in the array.
I use the same character, since the Font for the label is proportional. Thus, the
letter used will determine what width the label gets. The tricky part are the properties of the label. Set the WordWrap to False and the AutSize to True to make this work. The end results looks like this:
Great, isn't it? CommentsAdd a comment too!!!
| ||||||||||||||
|
Use the contact page to issue
questions or comments about this website. |