Adjust ListView columns to fit with WinForms

后端 未结 5 1646
不知归路
不知归路 2021-02-07 21:50

I have face resize problem of listview columns. If you anchor/docking the listview to normal winform than the listview anchor or docking works well. I mean lis

5条回答
  •  说谎
    说谎 (楼主)
    2021-02-07 22:39

    use this

    Private Sub ListView1_Resize(sender As Object, e As EventArgs) Handles ListView1.Resize
        Dim k = ListView1.Width - 10
        Dim i = k / 3
        ListView1.Columns(0).Width = k - i
        ListView1.Columns(1).Width = i / 2
        ListView1.Columns(2).Width = i / 2
    End Sub
    

    three columns one bigger two smaller with same size

提交回复
热议问题