我这样写不知道错在那里呀
VAR
BB:TBUTTON;
我在BUTTON1的CLICK事件写
BB:=TBUTTON.CREATE(BB);
BB.PARENT=TFORM1;
请改正为何不对呀急呀

解决方案 »

  1.   

    TO wlw88(飞扬)为何我在窗体上看不见我新建的按钮呀
      

  2.   

    BB:=TBUTTON.CREATE(form1); //OR  BB:=TBUTTON.CREATE(self); 
    BB.PARENT=TFORM1;
    BB.show;
      

  3.   

    wlw88(飞扬) dulei115() ( ) 信誉和起来就好BB:=TBUTTON.CREATE(self);Parent := Form1;
      

  4.   

    BB:=TBUTTON.CREATE(form1); //OR  BB:=TBUTTON.CREATE(self); 
    BB.PARENT:=FORM1;
    BB.top:=20;
    BB.left:=20;
    BB.height:=23;
    BB.width:=75;
    BB.caption:='Create Button'
    BB.show;
      

  5.   

    unit Unit1;
    {New一个Application,copy代码覆盖原代码,在对象监视器(Object Inspector)
    中通过下拉选择,设置Form1的OnCreate事件为FormCreate,然后直接运行就可看到效果}
    interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
        procedure MyClick(Sender:TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      a: array[1..100] of tbutton;implementation{$R *.dfm}procedure TForm1.MyClick(Sender: TObject);
    var
      i: integer;
      nam: string;
    begin
      i := strtoint(Trim(Copy(TButton(Sender).Name,7,3)));
      TButton(Sender).Visible := not TButton(Sender).Visible;
      i := i + 1;
      nam := 'button' + inttostr(i);
      if i <= 100 then
        TButton(FindComponent(nam)).Visible := not TButton(FindComponent(nam)).Visible
    end;procedure TForm1.FormCreate(Sender: TObject);
    var
      i: integer;
    begin
      for i := 1 to 100 do
      begin
        a[i] := tbutton.Create(self);
        with a[i] do
        begin
          Top := (i-1) div 10 * 20;
          Left := (i-1) mod 10 * 20;
          Height := 20;
          Width := 20;
          Name := 'button' + inttostr(i);
          Caption := '';
          Parent := Form1;
          OnClick := MyClick;
        end;
      end;
    end;end.
    ///////////////////////////////
    楼主的分太少了!!!!!!!!!