I have a WinForm application that has a list view in it. What I want to be able to do is have the right most column resize (width) whenever the window gets bigger or smaller. Is this possible? If so, which property is it controlled by?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
ListViewhas aColumnsproperty, which is a collection containing columns, and each of those columns has aWidthproperty:In order to keep the width of the last column such that it fills the rest of the list view, you could add something like the following to your Form’s
Resizeevent:You may have to subtract a bit more to avoid the horizontal scrollbar in case there is padding between the columns — I didn’t test it.