T
Tom
My goal is to dynamically adjust a SplitContainer's vertical split
between a directory TreeView on the left and a detailed file ListView
on the right.
The code is working but does not initialize correctly.
Rough Method >>
1) Autosize columns by setting widths = -1.
2) Clear items from list.
3) Fill list.
4) SplitterDistance = Form.ActiveForm.Width - 32 -
list.SumColumnWidths;
The "32" above is a trial and error factor that compensates for the
widths of the sizing borders, right scroll bar, and splitter width.
This technique works great AFTER the first screen is loaded. The
ListView has no extra space off to the right and 100% of the right
most column is visible. Thus the TreeView has maximum space and
produces a scroll bar if needed. The alignments stays sharp even upon
changing font sizes that force row height changes. It is slick!
Here is the root of the problem >>
At the end of the Form's constructor I placed print statements to echo
the column widths. They are all -1. Not until exiting the constructor
are the autosized columns' width property available for the
calculation. Thus the first screen splitter is not placed accurately.
This challenge is more about learning about objects than it is to just
make that first screen "pretty".
I've tried SuspendLayout() and various other guesses ... but obviously
no success.
Thanks for any help.
-- Tom
between a directory TreeView on the left and a detailed file ListView
on the right.
The code is working but does not initialize correctly.
Rough Method >>
1) Autosize columns by setting widths = -1.
2) Clear items from list.
3) Fill list.
4) SplitterDistance = Form.ActiveForm.Width - 32 -
list.SumColumnWidths;
The "32" above is a trial and error factor that compensates for the
widths of the sizing borders, right scroll bar, and splitter width.
This technique works great AFTER the first screen is loaded. The
ListView has no extra space off to the right and 100% of the right
most column is visible. Thus the TreeView has maximum space and
produces a scroll bar if needed. The alignments stays sharp even upon
changing font sizes that force row height changes. It is slick!
Here is the root of the problem >>
At the end of the Form's constructor I placed print statements to echo
the column widths. They are all -1. Not until exiting the constructor
are the autosized columns' width property available for the
calculation. Thus the first screen splitter is not placed accurately.
This challenge is more about learning about objects than it is to just
make that first screen "pretty".
I've tried SuspendLayout() and various other guesses ... but obviously
no success.
Thanks for any help.
-- Tom