控件数组??? 如何做到我点击按钮时就出来一个lable1,当我点击第二次是就出来第二个lable.在线等待! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var Count: Integer = 0;procedure TForm1.Button1Click(Sender: TObject);var MyLabel: TLabel;begin Inc(Count); MyLabel:= TLabel.Create(self); MyLabel.Parent:= Form1; MyLabel.Left:= (Count-1)* 50; MyLabel.Top:= (Count-1)* 20; MyLabel.Name:= 'Label'+IntToStr(Count); MyLabel.Caption:= 'Label'+IntToStr(Count);end; 动态创建label,或者先放几个label,他们的visable:=false,buttononclick时 改visable:=true; var Form1: TForm1; Count: Integer = 0; CanMove: Boolean = false; StartX, StartY : Integer;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var MyLabel: TLabel;begin Inc(Count); MyLabel:= TLabel.Create(self); MyLabel.Parent:= Form1; MyLabel.Left:= (Count-1)* 50; MyLabel.Top:= (Count-1)* 20; MyLabel.Name:= 'Label'+IntToStr(Count); MyLabel.Caption:= 'Label'+IntToStr(Count); MyLabel.OnMouseDown:= MyMouseDown; MyLabel.OnMouseMove:= MyMouseMove; MyLabel.OnMouseUp:= MyMouseUp;end;procedure TForm1.MyMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin CanMove:= true; StartX:= x; StartY:= y;end;procedure TForm1.MyMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin// if CanMove then begin TLabel(Sender).Left:= TLabel(Sender).Left+ x-StartX; TLabel(Sender).Top:= TLabel(Sender).Top+ y-StartY; end;end;procedure TForm1.MyMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin//CanMove:= false;end; joky1981老兄这个还是有问题呀,不过很谢谢你,能给详细一点吗? delphi的Active form的问题,哪位高手帮下忙,马上给分,急用 在filelistbox中显示的文件名称,如何实现按日期排序 如何设置SMTP保护?? fastreport预览后保存,再次预览时报错 怎样实现音视频文件播放的“变速不变调”播放? 如何将adoquery中字段为空的全部填上0,字段为数字型 字符串连接问题? 刚才几次结贴子都不成,不好意思,只给了前25名的分,接着散 我想问一下关于mediaplayer的问题 关于技术与资金合作--------请关注!! 请帮忙 请问如何在一个adoquery控件里将查询的记录结果存储?
Count: Integer = 0;procedure TForm1.Button1Click(Sender: TObject);
var
MyLabel: TLabel;
begin
Inc(Count);
MyLabel:= TLabel.Create(self);
MyLabel.Parent:= Form1;
MyLabel.Left:= (Count-1)* 50;
MyLabel.Top:= (Count-1)* 20;
MyLabel.Name:= 'Label'+IntToStr(Count);
MyLabel.Caption:= 'Label'+IntToStr(Count);
end;
buttononclick时 改visable:=true;
Form1: TForm1;
Count: Integer = 0;
CanMove: Boolean = false;
StartX, StartY : Integer;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
MyLabel: TLabel;
begin
Inc(Count);
MyLabel:= TLabel.Create(self);
MyLabel.Parent:= Form1;
MyLabel.Left:= (Count-1)* 50;
MyLabel.Top:= (Count-1)* 20;
MyLabel.Name:= 'Label'+IntToStr(Count);
MyLabel.Caption:= 'Label'+IntToStr(Count);
MyLabel.OnMouseDown:= MyMouseDown;
MyLabel.OnMouseMove:= MyMouseMove;
MyLabel.OnMouseUp:= MyMouseUp;
end;procedure TForm1.MyMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
CanMove:= true;
StartX:= x;
StartY:= y;
end;procedure TForm1.MyMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
//
if CanMove then
begin
TLabel(Sender).Left:= TLabel(Sender).Left+ x-StartX;
TLabel(Sender).Top:= TLabel(Sender).Top+ y-StartY;
end;
end;procedure TForm1.MyMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
//
CanMove:= false;
end;