06-01-2010, 08:19 PM
يمكن ايضا تحسين كود SendDataClick
مع تغيير اسماء المكون shape الى Shp_2 Shp_1 ... معدى المكون shape5 تركه باسمه .
PHP كود :
procedure TForm1.SendDataClick(Sender: TObject);
var
ShapClr: string;
n: Byte;
b: Char;
Shp: TShape;
begin
if (Hcom = Dword(-1)) or (Hcom <= 0) then Exit;
if SendValue(DataV.Value) then
ShapClr := Int2Bin(DataV.Value);
for n := 1 to 8 do
begin
b := ShapClr[n];
Shp := TShape(FindComponent('shp' + '_' + IntToStr(n)));
if Shp <> nil then
case b of
'1': Shp.Brush.Color := cllime;
'0': Shp.Brush.Color := clwhite;
end;
end;
end;
مع تغيير اسماء المكون shape الى Shp_2 Shp_1 ... معدى المكون shape5 تركه باسمه .


![[-]](https://delphi4arab.net/forum/D4A2020/collapse.png)