|
Update performance optimization
Sunday, 23 August 2009
After changes, treeview will need to recalculate an internal state and redraw itself. All internal changes (add or remove node/node control/column, etc.) will update the treeview automatically, but if you change external data or want to control the update process (on mass or frequently changes) to minimize performance overhead, you will need to update the treeview manually.
Treeview will auto–update itself when any data that it is familiar with has changed. To update the treeview after external data changes, call the FullRepaint method. Do not call it too often because it may hurt the treeview performance. Example: private void button1_Click(object sender, System.EventArgs e) { NodeWithImage node = (NodeWithImage)tree.Nodes[0]; // external data changes here. Treeview doesn`t know about these changes. node.Image.SetResolution(72, 72); // treeview complete update after changes. tree.FullRepaint(); }
|
|