N
newboy_kdg
Unregistered / Unconfirmed
GUEST, unregistred user!
这段程序是运行时动态创建56个按键
但是在运行的时候出错无法生成
(新手上路,请多指教)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
GroupBoxShortCutCall: TGroupBox;
private
{ Private declarations }
ShortcutCallA : Array [1..56] of TGroupBox;
btLeft, btTop, btWidth, btHeight : integer;
procedure CreateShortcutCallButtons;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.CreateShortcutCallButtons;
var i,j:integer;
begin
btLeft:=10;
btTop:=20;
btWidth:=53;
btHeight:=25;
for i:=1 to 8 do
for j:=1 to 7 do
begin
ShortcutCallA[(i-1)*7+j].ShotcutCallButton:=SpeedButton.Create(nil);
with ShortcutCallA[(i-1)*7+j].ShortcutCallButton do
begin
Left:=btLeft+(j-1)*btWidth;
Top:= btTop +(i-1)*btHeight;
Width:=btWidth;
Height:=btHeight;
Parent:=GroupBoxShortcutCall;
Visible:=True;
end;
end;
GroupBoxShortcutCall.Update;
end;
end.
但是在运行的时候出错无法生成
(新手上路,请多指教)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
GroupBoxShortCutCall: TGroupBox;
private
{ Private declarations }
ShortcutCallA : Array [1..56] of TGroupBox;
btLeft, btTop, btWidth, btHeight : integer;
procedure CreateShortcutCallButtons;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.CreateShortcutCallButtons;
var i,j:integer;
begin
btLeft:=10;
btTop:=20;
btWidth:=53;
btHeight:=25;
for i:=1 to 8 do
for j:=1 to 7 do
begin
ShortcutCallA[(i-1)*7+j].ShotcutCallButton:=SpeedButton.Create(nil);
with ShortcutCallA[(i-1)*7+j].ShortcutCallButton do
begin
Left:=btLeft+(j-1)*btWidth;
Top:= btTop +(i-1)*btHeight;
Width:=btWidth;
Height:=btHeight;
Parent:=GroupBoxShortcutCall;
Visible:=True;
end;
end;
GroupBoxShortcutCall.Update;
end;
end.