Registriert seit: 4. Jun 2004
Ort: Hamm
390 Beiträge
Delphi 2006 Professional
|
Re: Procedure schreiben die bei Objekten Eigenschften setzt!
19. Apr 2006, 12:59
Delphi-Quellcode:
procedure TForm1.ChangeObject(o : TControl; w, h, l, t : Integer; AFontStyle: TFontStyles);
begin
if w > -1 then o.Width:=w;
if h > -1 then o.Height:=h;
if l > -1 then o.Left:=l;
if t > -1 then o.Top:=t;
(o as TLabel).Font.Style := AFontStyle;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ChangeObject(Label1,100,50,-1,-1,[fsBold,fsItalic]);
end;
Oder:
Delphi-Quellcode:
procedure TForm1.ChangeObject(o : TControl; w, h, l, t : Integer; AFontStyle: TFontStyles);
begin
with o do begin
Width:=w;
Height:=h;
Left:=l;
Top:=t;
end;
(o as TLabel).Font.Style := AFontStyle;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ChangeObject(Label1,100,50,Label1.Left,Label1.Top,[fsBold,fsItalic]);
end;
Sascha
|
|
Zitat
|