我已经在procedure外面定义了一个全程数组
var tag:array [0..18,0..18] of integer;
为什么我在procedure里面调用tag的时候还会提示 array type required

解决方案 »

  1.   

    var
      i:integer=2;
      Form1: TForm1;
      tag:array [0..18,0..18] of integer;
      iblack:boolean;
    implementation{$R *.dfm}procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
           drawgrid1.Canvas.Pen.Color:=clwhite;
           drawgrid1.Canvas.brush.Color:=clwhite;
           drawgrid1.Canvas.Ellipse(acol*21,arow*21,(acol+1)*21,(arow+1)*21);
           if tag[acol,arow]=1 then
              drawgrid1.Canvas.Ellipse(acol*21,arow*21,(acol+1)*21,(arow+1)*21)
              else  if tag[acol,arow]=2 then
              drawgrid1.Canvas.arc(acol*21,arow*21,(acol+1)*21,(arow+1)*21,(acol+1)*21,(arow+1)*21,(acol+1)*21,(arow+1)*21);;
              
    end;
    procedure TForm1.DrawGrid1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    var col,row:integer;begin
           drawgrid1.Canvas.Pen.Color:=clBlack;
           drawgrid1.Canvas.brush.Color:=clBlack;
           drawgrid1.mousetocell(x,y,col,row);
           if tag[col,row]=0 then
              begin
                   if iblack then
                      tag[col,row]:=1
                      else tag[col,row]:=2
              end;
              iblack:=not iblack;
    end;end.上面代码中,凡是调用tag的地方,都会提示array type required
      

  2.   

    tag跟默认属性重复了
    换个名字就ok
      

  3.   

    保留字的问题
    比如name等等,都是系统保留字
    定义变量不要和这些重复。