我知道通过添加 TreeView.BeginUpdate 将防止树视图闪烁,但是当我将它添加到我的项目中时,我的树视图的所有节点都消失了,任何人都可以告诉我为什么会发生,这是我使用 TreeView 的代码片段.BeginUpdate 和 TreeView.EndUpdate
TreeNode treeNode = new TreeNode("Windows");
treeView1.Nodes.Add(treeNode);
//
// Another node following the first node.
//
treeNode = new TreeNode("Linux");
treeView1.Nodes.Add(treeNode);
//
// Create two child nodes and put them in an array.
// ... Add the third node, and specify these as its children.
//
TreeNode node2 = new TreeNode("C#");
TreeNode node3 = new TreeNode("VB.NET");
TreeNode[] array = new TreeNode[] { node2, node3 };
//
// Final node.
//
treeNode = new TreeNode("Dot Net Perls", array);
treeView1.Nodes.Add(treeNode);