Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. var i=0;
  2. foreach (DataGridViewColumn c in dataGridView1.Columns)
  3.  
  4. {
  5.  
  6. i += c.Width;
  7.  
  8.  
  9.  
  10. }
  11.  
  12. dataGridView1.Width = i + dataGridView1.RowHeadersWidth + 2;
  13.  
  14. dataGridView1.Height = dataGridView1.GetRowDisplayRectangle(dataGridView1.NewRowIndex, true).Bottom + dataGridView1.GetRowDisplayRectangle(dataGridView1.NewRowIndex, false).Height;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement