814123
2018-07-01 09:16
采纳率: 100%
浏览 965
已采纳

delphi treeview的子节点图标?

图片说明
代码实现不同的子节点图标效果。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • threenewbee 2018-07-01 18:17
    已采纳
     unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ImgList, ComCtrls, XPMan;
    
    type
      TForm1 = class(TForm)
        TreeView1: TTreeView;
        ImageList1: TImageList;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      node1: TTreeNode;
    begin
      node1 := treeView1.Items.AddFirst(nil, '全部待办事宜');
      node1.ImageIndex := 1;
      node1.SelectedIndex := 1;
      node1 := treeView1.Items.AddChildFirst(node1, '问问');
      node1.ImageIndex := 1;
      node1.SelectedIndex := 1;
      node1 := treeView1.Items.AddChild(node1.Parent, '1114');
      node1.ImageIndex := 1;
      node1.SelectedIndex := 1;
      node1 := treeView1.Items.AddChild(node1.Parent.Parent, '进度状态');
      node1.ImageIndex := 1;
      node1.SelectedIndex := 1;
      node1 := treeView1.Items.AddChildFirst(node1, '未处理');
      node1.ImageIndex := 0;
      node1.SelectedIndex := 0;
      node1 := treeView1.Items.AddChild(node1.Parent, '正在处理');
      node1.ImageIndex := 0;
      node1.SelectedIndex := 0;
      node1 := treeView1.Items.AddChild(node1.Parent, '已完成');
      node1.ImageIndex := 0;
      node1.SelectedIndex := 0;
      node1 := treeView1.Items.AddChild(node1.Parent.Parent, '更新时间');
      node1.ImageIndex := 1;
      node1.SelectedIndex := 1;
      node1 := treeView1.Items.AddChildFirst(node1, '今天更新');
      node1.ImageIndex := 0;
      node1.SelectedIndex := 0;
    end;
    
    end.
    
    已采纳该答案
    打赏 评论
  • threenewbee 2018-07-01 18:18

    图片说明

    打赏 评论
  • threenewbee 2018-07-01 18:21
    打赏 评论

相关推荐 更多相似问题