DataGridView, Virtual Mode and “lags”

后端 未结 1 1553
梦如初夏
梦如初夏 2021-01-21 21:50

My code looks as follows:

private void dataGridView4_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            Records recordsTmp  =         


        
相关标签:
1条回答
  • 2021-01-21 22:17

    One thing you want to play with is the autosizing of the cells, as the gridview will have to go through all your cells in order to find the one with the longest length. You should disable autosizing and you should do that programatically. Regarding your selection problem: selecting causes a lot of redraws, my hunch is that is redraws all your cells, therefore the lag is proportional to your row/cell count.

    In order to use Virtual Mode you need more than setting the VirtualMode to true. It would be interesting to see your dataGridView1_RowsAdded, dataGridView1_CellValuePushed and dataGridView1_CellValidating methods, since they are probably the culprit of the delays.

    0 讨论(0)
提交回复
热议问题