How to hide a column in a ListView control?

后端 未结 9 2327
慢半拍i
慢半拍i 2021-02-14 03:01

How can I hide a column in a ListView control, without setting the column Width property to 0?

Also, can I lock the Width

9条回答
  •  你的背包
    2021-02-14 03:19

    If you have only one column, a second empty column shows up to fill the extra space to the right. To hide this empty column, implement the listview resize event. In there do the following.

    m_lstItems.Columns[0].Width = m_lstItems.Width - 5;
    

    This will effecitvely hide the extra empty column and instead have the first column take up all the space in the listview.

提交回复
热议问题