Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
488 views
in Technique[技术] by (71.8m points)

c# - ObjectListView/TreeListView awful performance on Win10

I know the BrightIdeasSoftware/ObjectListView is a legacy project, but I have invested some time in it only to later notice that the TreeListView control is very sluggish, so much as moving in the list up and down using arrow keys is no longer an option.

I'd hate to abandon this control at this point as there are no better free Winforms treelistview controls avaiable. On a Win7 machine it still isn't fast, but MUCH better than on Win10. Any ideas what is causing this?

Example code to populate a simple TreeListView:

public partial class Form1 : Form
{
    public class Node
    {
        public int RowIndex { get; set; }
    };

    private List<Node> nodes = new List<Node>();

    public Form1()
    {
        InitializeComponent();

        var colCount = 5;
        var rowCount = 200;

        for(int i = 0; i < colCount; i++)
        {
            var col = new OLVColumn() { Text = $"Column {i} " };
            var index = i; // Can't use i directly inside lambda

            col.AspectGetter = obj => $"Row: {(obj as Node).RowIndex}, Col: {index}";
            treeListView1.AllColumns.Add(col);              
        }

        for(int i = 0; i < rowCount; i++)
        {
            var n = new Node()
            {
                RowIndex = i,
            };

            nodes.Add(n);
        }

        treeListView1.RebuildColumns();
        treeListView1.Objects = nodes;
    }
}

EDIT: I tried the package at https://www.myget.org/feed/geomatics/package/nuget/ObjectListView.Official, which seems to have this issue fixed, but it is not rendering TreeView lines and expanders at all.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...