在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
type TForm13 = class(TForm) Button1: TButton; ScrollBox1: TScrollBox; procedure Button1Click(Sender: TObject); private { Private declarations } procedure myClick(sender: TObject); public { Public declarations } end; var Form13: TForm13; implementation {$R *.dfm} procedure TForm13.Button1Click(Sender: TObject); const iHtoH = 20; //行间距 iWtoW = 10; //列间距 iPerLine = 6; //每行个数 iWidth = 80; //按钮宽度 var i: Integer; begin for i := 1 to 30 do begin with TButton.Create(Self) do begin Name := 'Btn' + InttoStr(i); Parent := Self.ScrollBox1; Caption := Name; Top := iHtoH + (30 + iHtoH) * (i div iPerLine - integer((i mod iPerLine) = 0)); Left := iWtoW + (iWidth + iWtoW) * ((i - 1) mod iPerLine); if Name = 'Btn5' then begin OnClick := myClick; end; Show; end; end; end; procedure TForm13.myClick(sender: TObject); begin ShowMessage('hello,world!'); end;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论