I have noticed that setting row height in DataGridView control is slow. Is there a way to make it faster?
+1
A:
If you can, try setting the height before you bind the control.
If you can't do that, try making the control hidden before setting the height.
Chris
2008-09-18 18:24:47
A:
This works in most cases but I'm not sure if this is what you are looking for...
Try setting up the RowTemplate and use that to set the rows height.
// my test to specify a size for a datagridview row
dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { Name = "ColumnNameGoesHere" });
dataGridView1.RowTemplate.Height = 50;
for (var x = 0; x <= 10000; x++)
{
dataGridView1.Rows.Add(x.ToString());
}
Here is also a nice page on Windows Forms Programming Best Practices for Scaling the Windows Forms DataGridView Control which you may find to be handy: http://msdn.microsoft.com/en-us/library/ha5xt0d9.aspx
ImJustPondering
2008-09-18 18:30:21
+2
A:
What's caused similar layout delays for myself was related to the AutoSizeRowsMode and AutoSizeColumnsMode
DataGridView1.AutoSizeRowsMode = None
will likely fix it.
Also try ColumnHeadersHeightSizeMode to None and AllowUserToResizeRows to False.
hometoast
2008-09-18 18:36:34