1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TTypeObj = (Bouton, Etiq, Image);
TForm1 = class(TForm)
Button1: TButton;
RadioGroup1: TRadioGroup;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
procedure Creer(Typeobj: TTypeobj; Name: string; Caption: string; Parent:string; Top: Integer; Left: Integer);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Typeobj: TTypeObj;
begin
creer(TTypeobj(radiogroup1.itemindex), edit1.Text, edit4.Text, edit5.Text, strtoint(edit2.Text), strtoint(edit3.Text));
end;
procedure tform1.Creer(Typeobj: TTypeobj; Name: string; Caption: string; Parent:string; Top: Integer; Left: Integer);
begin
case typeobj of
bouton:
begin
... code creation bouton
end;
Etiq:
begin
... code creation label
end;
Image:
begin
... code creation image
end;
end;
end;
end. |
Partager