Главная страница | назад





Article #16686: Resizing listviews

 Question and Answer Database
FAQ1686C.txt Resizing listviews
Category :VCL
Platform :All
Product :C++Builder 1.x
Question:
I have a form with a ListView control in it. I need to
resize the listview when the frame window changes size.
Answer:
You can set the Align property of your component to alClient and
then it will always fill the client area of the form when the
form is resized. To take that a step further, let's say your app
had a speed bar and a status bar. You would place a Panel on the
form for the speed bar and then change it's Align property to
alTop. Next place a StatusBar component on the form. It
automatically has it's Align property set to alBottom so it goes
to the bottom when you place it on the form. Finally, place your
tree view (is that right?) component on the form and change it's
Align property to alClient. The tree view expands to fill
whatever remains of the client area--in this case the space
between the speed bar Panel at the top and the StatusBar at the
bottom.
To answer your question directly, you change a component's size
by modifying it's Top, Left, Width, or Height properties as
required. To do it all at one time use the SetBounds() method.
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99