请问怎样用程序在Notebook任意Page上面添加不同的组件,如Button等,谢谢。
解决方案 »
- 怎么在其他pas文件中修改form1的控件属性?
- 游戏服务端程序--delphi开发
- DELH哪个版本好
- 软件完成后,....请问哪些文件是不用打包发布的?
- 高分,數組清空
- 下面三位哥们进来领分 yujohny(踏网无痕) ,lxh00789(li) wyr521(论坛王子)
- delphi2010无法安装,怎么办?
- ehlib如何合计到第一行
- 當在程序中打開一個數據庫窗體時﹐有時會出現"Access Violation at address 004032be in module 'MyTest.exe',Read of Address 44427070
- 写了个Global Hotkey的控件,但死活不运行用户的事件,帮忙看看吧!
- 基础OOP问题,关于 OVERLOAD + VIRTUAL...
- 滚动条的使用问题
你可以在这个基础上修改成你想要的状态;{
测试环境:delphi6/win2000
}
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Notebook1: TNotebook;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
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.