I want to do a status window display beds, bed table is bcq1, including bcq13 is beds, there are two value of 0 and 1 at the same time, the different parts of the different beds, bck01a is area id, I want to show some regional state of beds, bcq13 is 0, the font color is green, 1 red, to either 0 or 1, however, is a color, as my code below, also please the teacher give directions:
Procedure TForm1. Button1Click (Sender: TObject);
Type
Bed=record
M: string;
N, p, q: integer;
end;
Var
I, j, k, z: integer;
S: the bed;
Const
NamePrefix='a';
The begin
Adoquery1. Close;
Adoquery1. SQL. The Add (' select ROW_NUMBER () over (order by bcq01) row, bck01a, bcq04, bcq13 from bcq1 where bck01a="h");
Adoquery1. The Parameters. ParamByName (' h '). The Value:='37';
Adoquery1. Open;
S.m:=adoquery1 fieldbyname (' bcq04). AsString;
S.n:=adoquery1 fieldbyname (' bck01a). AsInteger;
Supachai panitchpakdi:=adoquery1 fieldbyname (' bcq13). AsInteger;
S.q:=adoquery1 fieldbyname (' row '). AsInteger;
Z:=adoquery1. RecordCount;
For I:=1 to z do
The begin
J:=I;
K:=((I - 1) div 8) + 1;
TLabel. Create (Self). Name:=NamePrefix + IntToStr (I);
With TLabel (FindComponent (NamePrefix + IntToStr (I))) do
The begin
Left:=30 + (j (k - 1) * 8) * 150;//each row shows eight
Top:=120 + k * 50;//each row spacing 50
Parent:=the self;
The font Size:=20;
//canvas. Pen. Width:=3;
If supachai panitchpakdi=0 then
The begin
The font Color:=RGB (0250, 0);
End
The else
The begin
The font Color:=RGB (0, 250);
End
end;
end;
end;
CodePudding user response:
Change the color of the controls to browse control ways, to change its properties,CodePudding user response:
Self. Findcomponent into selfCodePudding user response: