Auto-size Listview

  • Thread starter Thread starter Mantorok
  • Start date Start date
M

Mantorok

Hi all

I have a listview, after I've added all of the items in the listview I want
to set the height so that all items can be viewed at once.

Can this be done, if so, how?

Thanks
Kev
 
Hi,

What if you have more items that space available to the listview?

Are you using Details view?

If so use Graphics.MeasureString to get the size of the string, you are
really interested in the height, multiply that for the number of items maybe
you will need to add a constant quantity for the borders and you have the
needed space to show all items.
 
Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

What if you have more items that space available to the listview?

Not to bothered about that, it's handled elsewhere.
Are you using Details view?
Yep.

If so use Graphics.MeasureString to get the size of the string, you are
really interested in the height, multiply that for the number of items
maybe you will need to add a constant quantity for the borders and you
have the needed space to show all items.

What control needs to be measured by MeasureString?

Thanks
Kev
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top