如何做到我点击按钮时就出来一个lable1,当我点击第二次是就出来第二个lable.在线等待!

解决方案 »

  1.   

    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;
      

  2.   

    动态创建label,或者先放几个label,他们的visable:=false,
    buttononclick时 改visable:=true;
      

  3.   

    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;
      

  4.   

    joky1981老兄这个还是有问题呀,不过很谢谢你,能给详细一点吗?