unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AdvSmoothButton, StdCtrls, ComCtrls;
type
TForm1 =
class(TForm)
tree: TTreeView;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
myButton : TButton;
i, int_Top_offset, main_Left, int_Left_offset : integer;
begin
tree.FullExpand;
int_Top_offset := 30;
int_Left_offset := 20;
main_Left := 0;
for i := 0
to tree.Items.Count-1
do
begin
myButton := TButton.Create(self);
myButton.Parent := Form1;
myButton.Top := (tree.Items.Item[i].Level * 45) + int_Top_offset;
myButton.Height := 30;
inc(main_Left);
myButton.Left := (main_Left * 75) + int_Left_offset;
myButton.Caption := tree.Items.Item[i].Text;
myButton.Visible := true;
end;
form1.Repaint;
end;
end.