DataGridView AutoFit and Fill

前端 未结 10 640
孤独总比滥情好
孤独总比滥情好 2020-12-02 07:37

I have 3 columns in my DataGridView. What I am trying to do is have the first 2 columns auto fit to the width of the content, and have the 3rd column fill the r

10条回答
  •  时光取名叫无心
    2020-12-02 07:59

    public void setHeight(DataGridView src)
    {
        src.Height= src.ColumnHeadersVisible ? src.ColumnHeadersHeight : 0 +   src.Rows.OfType().Where(row => row.Visible).Sum(row => row.Height);
    }
    

提交回复
热议问题