delphi 用定义数组变量实现控件数组

2023-05-29  本文已影响0人  大龙10

一、控件数组的实现

var
  Form1: TForm1;
  fcImage_p : array[1..84] of TfcImageBtn ;

procedure  fcImage_pp;//定义数组变量实现控件数组
begin
    fcImage_p[1]:=fcImageBtn_1;
    fcImage_p[2]:=fcImageBtn_2;
    fcImage_p[3]:=fcImageBtn_3;
    fcImage_p[4]:=fcImageBtn_4;
    fcImage_p[5]:=fcImageBtn_5;
    fcImage_p[6]:=fcImageBtn_6;
    fcImage_p[7]:=fcImageBtn_7;
    fcImage_p[8]:=fcImageBtn_8;
    fcImage_p[9]:=fcImageBtn_9;
    fcImage_p[10]:=fcImageBtn_10;
end;

procedure disp; //循环显示
begin
      for col:= 1 to 14 do
        for  row:=1 to 6 do
         begin
           P_status:= Global.Disp_Pallet[col,row];
           if  (col mod 2)=1 then
            begin
               if  (P_status and ($0100)=($0000))  then   // 不存在
                     DrawColor( (fcImage_p[col*6+row*2-7] as TfcImageBtn), Color_G,0)
               else  if (P_status and ($0100)=($0B00)) then  //视觉和称重ok ,为绿;
                     DrawColor( (fcImage_p[col*6+row*2-7] as TfcImageBtn), Color_W,1)
               else
                     DrawColor( (fcImage_p[col*6+row*2-7] as TfcImageBtn), Color_G,1);
            end;
         end;
end;

二、界面

上一篇下一篇

猜你喜欢

热点阅读