Performance in Windows Forms MultiColumn TreeView
8 Jul 20261 minute to read
The performance of the MultiColumnTreeView can be improved by using the following properties and methods.
SuspendExpandRecalculate
When the SuspendExpandRecalculate property is set to true, the populating time is nearly halved by recalculating the maximum height of the nodes only while expanding and collapsing.
This also reduces the unnecessary recalculation of dimensions for child nodes when the root nodes are collapsed.
this.multiColumnTreeView1.SuspendExpandRecalculate = true;Me.multiColumnTreeView1.SuspendExpandRecalculate = TrueThe following methods can be used to temporarily stop painting of nodes so that new nodes can be added to the control in between these calls.
| MultiColumnTreeView Methods | Description |
|---|---|
| BeginUpdate | Calling this method will stop the redraws of the control and makes the node addition faster than normal. |
| EndUpdate | Resumes the painting of the control suspended by BeginUpdate method. |
this.multiColumnTreeView1.BeginUpdate();
//Add more node here
this.multiColumnTreeView1.EndUpdate();Me.multiColumnTreeView1.BeginUpdate()
' Add more node here
Me.multiColumnTreeView1.EndUpdate()