我想将两个Treeview合成一个控件的方法你应该会吧,
具体方式可以如下:
TMyControl=class(TPanel)
private
FFatherTree: TTreeView;
FSonTree: TTreeView;
procedure FatherTreeChange(Sender: TObject; Node: TTreeNode);
public
constructor create(AOwner:TComponent);override;
end;
implementation
{TMyControl}
constructor TMyControl.Create(AOwner:TComponent);
begin
inherited create(AOwner);
FFatherTree := TTreeView.Create(Self);
FFatherTree.Parent := Self;
FFatherTree.OnChange := FatherTreeChange;
FFatherTree.Width := Self.Width div 2;
FFatherTree.Align := alLeft;
FSonTree := TTreeView.Create(Self);
FSonTree.Parent := Self;
FFatherTree.Align := alClient;
end;
procedure TMyControl.FatherTreeChange(Sender: TObject; Node: TTreeNode);
begin
{第一个树节点变化时根据Node重新构造第二个树的所有内容}
end;