delphi treeview的子节点图标?

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

3个回答

 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.

图片说明

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问