DataGridView White Space After Last Column Header

前端 未结 4 761
时光说笑
时光说笑 2021-02-09 20:28

I\'m trying to mimic what every other tabular view does with the DataGridView control, but I can\'t seem to get the headers correct.

I want a blank header to the right o

4条回答
  •  借酒劲吻你
    2021-02-09 20:58

    Try this

    Dim dt As New DataTable()
    dt.Columns.Add("a")
    dt.Columns.Add("b")
    dt.Rows.Add(dt.NewRow())
    dt.Rows.Add(dt.NewRow())
    dt.Rows.Add(dt.NewRow())
    dt.Rows.Add(dt.NewRow())
    dt.Rows.Add(dt.NewRow())
    dt.Rows.Add(dt.NewRow())
    dt.Columns.Add(" ")
    dt.AcceptChanges()
    DataGridView1.DataSource = dt
    DataGridView1.AutoSize = True
    DataGridView1.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
    DataGridView1.Columns(2).Resizable = DataGridViewTriState.False
    

提交回复
热议问题