урок на делфи 24 - управление компонентам
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button5Click(Sender: TObject);
var i:integer;
begin
for i:=0 to 4 do
if Components[i] is TLabel then
begin
TLabel(Components[i]).Caption:='новое название '+IntToStr(i);
end;
end;
procedure TForm1.Button6Click(Sender: TObject);
var i:integer;
begin
for i:=0 to 7 do
if Components[i] is TButton then
begin
TButton(Components[i]).visible:=false;
end;
end;
end.