我想用delphi做一个汉诺塔演示程序
想用TShape来做
但是我声明一个shape:
var
bar:TShape;
begin
bar.Create;
bar.shape:=stRectangle;
bar.left:=100;
bar.top:=200;
end
怎么没有见到shape出现?

解决方案 »

  1.   

    bar.Create;
    改为
    bar:=TShape.create;
      

  2.   

    var
      bar:TShape;
    begin
      bar:=TShape.Create(self);//构造函数是这样用的....
      bar.Parent:=self;//必须要设置拥有者
      bar.Width:=100;
      bar.Height:=100;
      bar.Top:=100;//位置也要设置
      bar.Left:=100;
      bar.Visible:=true;//不让它显示它是不会出来地......
    end;
      

  3.   

    在uses中添回ExtCtrls单元文件
    var
      bar:TShape;
    begin
      bar:=TShape.Create(self);
      bar.Parent:=self;               //必须要设置拥有者
      bar.shape:=stRectangle;
      bar.left:=100;
      bar.top:=200;
    end;