Flickering in ListView control (OwnerDraw, Virtual)

前端 未结 3 1855
长情又很酷
长情又很酷 2021-02-07 23:08

This question might be considered a follow-up to Flickering in listview with ownerdraw and virtualmode.

I\'ve got a ListView control in Virtu

3条回答
  •  被撕碎了的回忆
    2021-02-07 23:34

    At least for double buffering for OnDrawItem, it is incorrect that there is a bug, but it is a little bit stupid: there is a protected attribute you can set, but you need to override the ListView. I created this kind of class:

    public class MyListView : ListView
    {
        public MyListView()
            : base()
        {
            DoubleBuffered = true;
        }
    }
    

    And then in my MyForm.Designer.cs file I change the instantiation of the ListView with the following line:

    private ListView myListView;
    
    this.myListView = new MyListView();
    

    And OnDrawItem will work like a charm!

提交回复
热议问题