C# WinForms DataGridView background color rendering too slow

后端 未结 5 1851
挽巷
挽巷 2021-02-20 14:52

I\'m painting my rows in a DataGridView like this:

private void AdjustColors()
    {            
        foreach (DataGridViewRow row in aufgabenDataGridView.Row         


        
5条回答
  •  情深已故
    2021-02-20 15:25

    As SwDevMan1 said, you should first work on removing the Enum.Parse call. Are you using data binding to populate the grid? If so, you can use Rows[index].DataBoundItem to access the data bound object for the row and access the AufgabeStatus status directly.

    The second tweak I would suggest is to call SuspendLayout() and ResumeLayout() before and after, respectively, manipulating the grid.

提交回复
热议问题