Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello all,

 

Does anyone know how to adjust the width of your columns when using a ListView object?

 

listView1.get_Columns().Add("Description", -2, HorizontalAlignment.Left);

 

For some reason I through that the �-2� dictated the column width. However if I adjust this (either way) it just makes the width smaller.

 

Any ideas with be gratefully received.

 

Harold Clements

Posted
Hello all,

 

Does anyone know how to adjust the width of your columns when using a ListView object?

 

Harold Clements

 

 

Hi haroldjclements,

 

use the following line of code:

 

//[0] = number of the column you wish to change
this.listView1.Columns[0].Width = 200;

 

You have to add columns to the listview's columns collection for this to work (if u haven't already).

See "columns" property in property window and add columns there.

Posted

Sorted it :D

 

Rather then declare the columns and the headers together, I created a ColumnHeader object and then used the .set_Width() method.

 

It works fine, so I am happy.

 

Cheers everyone,

Harold Clements

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...