【问题标题】:Current Node Icon not same as Default Node Icon当前节点图标与默认节点图标不同
【发布时间】:2012-08-13 20:31:37
【问题描述】:

我有一个带有命名节点的 Treeview。为了帮助用户,每个节点都可以有四个图标之一。默认项目 (0) 为白色。

我很困惑,但我知道我已经确定了“错误行为”。

图标设置正确并且在我的 Treeview 中是正确的,但是每次我“单击”一个节点时,它都会被选中并显示默认图标(白色)。

如何更改行为以使所选节点显示正确的图标?

【问题讨论】:

    标签: c# treeview icons


    【解决方案1】:

    首先为节点图像命名:

    this.treeView.ImageList.Images.Add("TABLE", global::OrangeUI.Properties.Resources.table);
    

    你可以像这样设置不同的图标:

    this.treeView.SelectedNode.ImageKey = "TABLE"; this.treeView.SelectedNode.SelectedImageKey
    = "TABLE";
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-04-16
      • 2013-07-11
      • 1970-01-01
      • 2013-06-30
      • 1970-01-01
      • 1970-01-01
      • 2015-06-06
      相关资源
      最近更新 更多