/// <summary>
/// 初始化树列表
/// </summary>
private void InitTreeList()
{
Dictionary<string, TreeListNode> dictNode = new Dictionary<string, TreeListNode>();
treeIMGList.Nodes.Clear();
TreeListNode rootNode;
for (int i = 0; i < pListRsVersionInfo.Count; i++)
{
RasterVersionInfo moInfo = pListRsVersionInfo[i];
if (dictNode.ContainsKey(moInfo.DATAMODELNAME))
{
rootNode = dictNode[moInfo.DATAMODELNAME];
}
else
{
TreeListNode node = treeIMGList.AppendNode(new object[] { moInfo.DATAMODELNAME }, null);
dictNode.Add(moInfo.DATAMODELNAME, node);
rootNode = node;
}
TreeListNode childNode = treeIMGList.AppendNode(new object[] { moInfo.VERSIONNAME }, rootNode, moInfo.VERSIONNAME);
}
if (treeIMGList != null && treeIMGList.Nodes.Count > 0)
{
treeIMGList.SetFocusedNode(treeIMGList.Nodes[0]);
treeIMGList.Nodes[0].ExpandAll();
}
}
TreeList 初始化示例
最新推荐文章于 2020-07-20 23:45:11 发布