ListView Final Column Autosize creates scrollbar

前端 未结 8 1206
闹比i
闹比i 2021-01-13 18:23

I am implementing a custom control which derives from ListView.

I would like for the final column to fill the remaining space (Quite a common task), I have gone abou

8条回答
  •  天命终不由人
    2021-01-13 19:11

    This may be pretty late, but i believe the easiest solution is to add a function to handle the window resize event. I have my listview anchored to the right, so when i resize my window, the listview also resizes. in the function that handles the window resize, i set the myListView.Columns[lastColumnIndex].Width = -2;

    This apparently redraws the listview, extending the last column to the edge of the control. Hope this helps.

提交回复
热议问题