DataGridView CellPainting Not Fully Working on Scroll

后端 未结 1 913
别那么骄傲
别那么骄傲 2021-01-22 17:14

First post, but long time browser :)

So here\'s my problem: Basically I have a datagridview that I am using to interact with the user. In all of the rows, there is an

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

    Figured it out. Needed to create a double buffer for the datagridview by doing the following:

    class CustomDataGridView : DataGridView {
    
    public CustomDataGridView() {
        base.DoubleBuffered = true;
    }
    }
    

    I also put the code into the RowPostPainting event and changed the if statement to:

    if (e.RowIndex == i) { .... }
    

    Hopefully this helps somebody else out.

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