var button: TButton; begin button := TButton.Create(Self); with button do begin Parent := Self; Left := 0; Top := 0; Width := 100; Height := 100; Caption := 'Button1'; Visible := True; end; end;
sysu:可以动态生成他 但是现在就是该怎样把他拉大或者放小一些呢!
procedure TForm1.Formcreate(Sender:TObject); var button: TButton; begin button := TButton.Create(Self); with button do begin Parent := Self; Left := 0; Top := 0; Width := 100; Height := 100; Caption := 'Button1'; Visible := True; end; end;
begin
button := TButton.Create(Self);
with button do begin
Parent := Self;
Left := 0;
Top := 0;
Width := 100;
Height := 100;
Caption := 'Button1';
Visible := True;
end;
end;
但是现在就是该怎样把他拉大或者放小一些呢!
var
button: TButton;
begin
button := TButton.Create(Self);
with button do begin
Parent := Self;
Left := 0;
Top := 0;
Width := 100;
Height := 100;
Caption := 'Button1';
Visible := True;
end;
end;
http://expert.csdn.net/Expert/topic/1456/1456413.xml?temp=.9850733
比如
width:=150;
height:=150;
就可以把button拉大,
而left和top则是button在form中的位置大家一起学习
怎样删除一个动态的控键呢!
Button:TButton;begin
Button:=TButton.Create(nil);
Button.SetBounds(left,top,width,heigth);
Button.Parent:=Form1;
end;大概就这个样子,改一下就可以了
我控间移动的时候成了一个窗体这是怎么回事?
方法上面的老兄已经说的没得说了,我也就不再重复了,下面是调整控件大小的代码:
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin //if ((X-bt.Left<=bt.Width) and (y-bt.top<=bt.Height ))then
if ssLeft in Shift then
begin
Bt.Width:=X-x0;
Bt.Height:=Y-y0;
end;
end;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
x0:=x;
y0:=y;end;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);把 参数赋了就可以了
我动态生成一个控件后,我要调用Image1MouseDown事件.
b.MouseDown:=Image1MouseDown(nil,nil,nil,x,y);
你帮我看看,
那么你可以在BUTTON2中写 BUTTON1Click(Sender);
就行了