var
Form1: TForm1;
Nid :Longint;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
btn : Tbutton;
begin
btn:=Tbutton.Create(nil);
btn.Top := 20;
btn.Left := 40;
btn.Caption := 'NPbutton';
btn.Name := 'btn';
btn.Parent := TWincontrol(Nid);
btn.Show;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if notebook1.PageIndex<2 then
notebook1.PageIndex := Notebook1.PageIndex +1
else
Notebook1.PageIndex :=0;
edit1.Text := inttostr(Notebook1.pageindex);
Nid:=Longint(Notebook1.Controls[Notebook1.pageindex]);
end;
end.
博客给出了一段Delphi代码,包含按钮创建和页面索引切换功能。代码中创建了一个按钮并设置其位置、标题等属性,还实现了在Notebook组件中切换页面索引,并将当前索引显示在编辑框中。

2962

被折叠的 条评论
为什么被折叠?



