F
F
fman22016-04-23 13:32:43
C++ / C#
fman2, 2016-04-23 13:32:43

How to properly render a CustomTreeNode in WinForms (C#)?

Good afternoon! Please help.
There is a class:

class TreeNodeItem: TreeNode
    {
        public string uid { get; set; }
        public string firstName { get; set; }
        public TreeNodeItem(String nodeText)
        {
            this.Text = nodeText;
        }
    }

I fill a TreeView with 100 nodes with class instances.
Next, I have my own rendering of the node:
protected override void OnDrawNode(DrawTreeNodeEventArgs e)
 {
    TreeNodeItem node = (TreeNodeItem) e.Node; // тут дичайшие тормоза
    // код отрисовки...
 }

But I am faced with the fact that I have wild brakes and friezes when rendering if I do type casting. But I don’t understand how else to pull my data out of the node and draw it?
I am using Windows Forms.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question