C
cuidekun98
Unregistered / Unconfirmed
GUEST, unregistred user!
点一下,按钮生成一个Edit,一下子点了很多,生成了很多个,想删除其中几个,请问该怎么写呢?以下是我的代码
procedure TForm1.FlatButton1Click(Sender: TObject);
var
FControl : TWinControl;
begin
with TLabel.Create(FlatPanel1) do begin //创建Label
Parent := FlatPanel1;
Name := Propertie.Text+ 'Caption'; //指定属性名称
Caption := display.Text; //指定显示名称
AutoSize:=true;
Top :=8;
Left :=5;
Display.Text := '';
end;
with TFlatEdit.Create(FlatPanel1) do begin //创建Edit
Parent := FlatPanel1;
Name:=Propertie.Text;
OndblClick := DymaticComdblClick;
OnMouseDown := DymaticComMouseDown; //事件
PopupMenu:=PopupMenu1;
Top :=5;
FControl := TWinControl(FlatPanel1.FindComponent(Propertie.Text+ 'Caption'));
Left := FControl.Left + FControl.Width + 5;
Hint := Propertie.Text+ 'Caption'; //为Hint赋值
Propertie.Text := '';
procedure TForm1.FlatButton1Click(Sender: TObject);
var
FControl : TWinControl;
begin
with TLabel.Create(FlatPanel1) do begin //创建Label
Parent := FlatPanel1;
Name := Propertie.Text+ 'Caption'; //指定属性名称
Caption := display.Text; //指定显示名称
AutoSize:=true;
Top :=8;
Left :=5;
Display.Text := '';
end;
with TFlatEdit.Create(FlatPanel1) do begin //创建Edit
Parent := FlatPanel1;
Name:=Propertie.Text;
OndblClick := DymaticComdblClick;
OnMouseDown := DymaticComMouseDown; //事件
PopupMenu:=PopupMenu1;
Top :=5;
FControl := TWinControl(FlatPanel1.FindComponent(Propertie.Text+ 'Caption'));
Left := FControl.Left + FControl.Width + 5;
Hint := Propertie.Text+ 'Caption'; //为Hint赋值
Propertie.Text := '';