Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Why are some rows higher than others in datagridview?


Asked by Sophia West on Dec 02, 2021 FAQ



I've also noticed that when AutoResizeMode is set to DisplayedCells and I display 200 rows of test data, the heights of rows 182-193 seem to have appropriate heights while the others are smaller than they should be, Any suggestions? Also, can anyone explain why DataGridView row sizing is affected by which rows are displayed?
In respect to this,
The DataGridViewRow class represents a row in a DataGridView control. You can retrieve rows through the Rows and SelectedRows collections of the control. Unlike a DataGridViewColumn, a DataGridViewRow physically contains a collection of all of the cells in that row. You can access this collection through the Cells property.
Indeed, You will feel no difference between this way of DataGridView population and data binding if you work with several rows. But if your grid has hundreds or thousands of rows, the performance degrades dramatically when the number of rows increases.
Likewise,
You can control the appearance of DataGridView rows by handling one or both of the DataGridView.RowPrePaint and DataGridView.RowPostPaint events. These events are designed so that you can paint only what you want to while letting the DataGridView control paint the rest.
In fact,
But DataGridView can load and display a large amount of data fast enough if you use the proper approach. The fastest way to populate an instance of the DataGridView control is to use data binding through its DataSource property.