[cLe Prog resemble a ca :
 
 
unit Ugraph1;
 
interface
 
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls , contnrs, Menus, Buttons, ComCtrls ;
 
type
 
  TFdesigner = class(TForm)
    BtModifCouleur: TButton;
    BtRedessine: TButton;
    ColorDialog1: TColorDialog;
    RadioGroup1: TRadioGroup;
    BtEditer: TBitBtn;
    ListBox1: TListBox;
    BtlistObjet: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BtModifCouleurClick(Sender: TObject);
    procedure BtRedessineClick(Sender: TObject);
    procedure BtEditerClick(Sender: TObject);
    procedure BtlistObjetClick(Sender: TObject);
 
 
  private
    { Déclarations privées }
    ListeObjGraph : TObjectList;
  public
    { Déclarations publiques }
  end;
 
  TpointG = class(Tobject)
  private
    couleur: Tcolor;
    X      : Integer;
    Y      : Integer;
  public
    procedure affiche ; Virtual;
    constructor Init(X_,Y_: Integer; Couleur_ : Tcolor);
    procedure ModifCouleur (newCouleur : Tcolor);
    procedure edition ; Virtual;
  end;
 
  Tligne  = class(TpointG)
  private
    Xfin : Integer ;
    Yfin : Integer ;
  public
    procedure affiche; OverRide;
    constructor Init (X_,Y_,Xfin_,Yfin_: Integer; Couleur_ : Tcolor);
    procedure edition ; OverRide;
  end;
 
  Tcercle = class(Tligne)
  public
    procedure affiche; overRide;
    constructor Init (X_,Y_,Xfin_,Yfin_: Integer; Couleur_ : Tcolor);
    procedure edition ; OverRide;
  end;
 
var
  Fdesigner: TFdesigner;
 
 
{-------------------------------------------------------------------------------}
                               implementation
{-------------------------------------------------
 
 
 
------------------------------}
{$R *.DFM}
 
Uses UeditionLigne, Ueditionpoint, Ueditioncercle;
 
 
{********************************** TpointG ****************************}
 
procedure TpointG.affiche;
begin
  Fdesigner.Canvas.Pixels [X,Y] := Couleur;
 
end;
 
 
{-------------------------------------------------
 
 
 
------------------------------}
{ Fenetre d edition d un point }
{-------------------------------------------------------------------------------}
 
procedure TpointG.edition ;
begin
  FeditionPoint := TFeditionPoint.create (application) ;  // ouverture fenetre EditionPoint
  If FeditionPoint.ShowModal = mrOk then
  Begin
    X := StrToInt (FeditionPoint.EcoordX.text);
    Y := StrToInt (FeditionPoint.EcoordY.text);
     
  end;
  FeditionPoint.Release;      // destruction de la fenetre
end;
 
{-------------------------------------------------
 
 
 
------------------------------}
{ }
{-------------------------------------------------------------------------------}
 
constructor TpointG.Init(X_, Y_: Integer; Couleur_: Tcolor);
begin
  create;
  X       := X_;
  Y       := Y_;
  Couleur := couleur_;
end;
 
{-------------------------------------------------
 
 
 
------------------------------}
{ Affecte la nouvelle couleur à la couleur de TpointG }
{-------------------------------------------------------------------------------}
procedure TpointG.ModifCouleur (newCouleur : Tcolor);
begin
  couleur := newCouleur;
end;
 
 
 
{****************************** Tligne ********************************}
 
procedure Tligne.affiche;
begin
  Fdesigner.Canvas.pen.Color := couleur;
  Fdesigner.Canvas.MoveTo (X,Y);
  Fdesigner.Canvas.LineTo (Xfin,Yfin);
 
end;
 
 
{-------------------------------------------------
 
 
 
------------------------------}
{Fenetre d edition d une ligne }
{-------------------------------------------------------------------------------}
procedure Tligne.edition;
begin
  FeditionLigne := TFeditionLigne.Create (application);
  If FeditionLigne.ShowModal = mrOk then
  Begin
    X := StrToInt (FeditionLigne.EcoordX.text);
    y := StrToInt (FeditionLigne.EcoordY.text);
    Xfin := StrToInt (FeditionLigne.EcoordXfin.text);
    yfin := StrToInt (FeditionLigne.EcoordYfin.text);
           
  end;
  FeditionLigne.Release;   // destruction de la fenetre
 
end;
 
{-------------------------------------------------
 
 
 
------------------------------}
{ }
{-------------------------------------------------------------------------------}
constructor Tligne.Init(X_,Y_,Xfin_,Yfin_: Integer; Couleur_: Tcolor);
 
begin
 Inherited Init  (X_, Y_, Couleur_);
  Xfin := Xfin_;
  Yfin := Yfin_;
 
end;
 
 
{-------------------------------------------------
 
 
 
------------------------------}
{  Créations de la liste des objets graphiques
{-------------------------------------------------
 
 
 
------------------------------}
procedure TFdesigner.FormCreate(Sender: TObject);
begin
  ListeObjGraph := TObjectList.Create;
end;
 
{-------------------------------------------------
 
 
 
------------------------------}
{  fermeture de la fenetre et demande d'autorisation de fermeture}
{-------------------------------------------------
 
 
 
------------------------------}
procedure TFdesigner.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  ListeObjGraph.free;
  ListeObjGraph := nil;
end;
 
{-------------------------------------------------------------------------------}
{  Modification de la couleur }
{-------------------------------------------------------------------------------}
procedure TFdesigner.BtModifCouleurClick(Sender: TObject);
var index     : Integer;
    ObjGraph  : TpointG;
    newcouleur: Tcolor ;
begin
  If ColorDialog1.Execute then      // ouvre la fenetre de couleur
  Begin
    newCouleur := ColorDialog1.Color ; // Memorisation de la nouvelle couleur
    For index := 0 to (ListeObjGraph.Count -1)do  // recherche de chaque objet
    begin
      ObjGraph := ListeObjGraph.Items [Index] as TpointG;
      ObjGraph.ModifCouleur(newcouleur); // affectetion de la nouvelle couleur
    end ;
  end;
end;
 
{-------------------------------------------------------------------------------}
{  Redessine tout en remplacent la couleur précédente  }
{-------------------------------------------------------------------------------}
 
 
procedure TFdesigner.BtRedessineClick(Sender: TObject);
var index     : Integer;
    ObjGraph  : TpointG;
begin
  For index := 0 to (ListeObjGraph.Count -1)do
  begin
    ObjGraph := ListeObjGraph.Items [Index] as TpointG;
    ObjGraph.affiche;
  end;
end;
 
 
{********************************** Tcercle **************************}
 
procedure Tcercle.affiche;
begin
  Fdesigner.Canvas.Ellipse ( X, Y, Xfin, Yfin);
  Fdesigner.Canvas.pen.Color := couleur;
 
end;
 
{-------------------------------------------------
 
 
 
------------------------------}
{Fenetre d edition du cercle }
{-------------------------------------------------------------------------------}
 
 
procedure Tcercle.edition;
begin
  FeditionCercle := TFeditionCercle.Create (application);
  If FeditionCercle.ShowModal = mrOk then
  Begin
    X := StrToInt (FeditionCercle.EcoordX.text);
    y := StrToInt (FeditionCercle.EcoordY.text);
    Xfin := StrToInt (FeditionCercle.EcoordXfin.text);
    yfin := StrToInt (FeditionCercle.EcoordYfin.text);
  end;
   FeditionCercle.Release;      // destruction de la fenetre
 
end;
 
 {-------------------------------------------------------------------------------}
 { }
 {-------------------------------------------------------------------------------}
constructor Tcercle.Init(X_, Y_, Xfin_, Yfin_: Integer; Couleur_: Tcolor);
begin
  Inherited Init (X_, Y_, Xfin_, Yfin_, Couleur_);
end;
 
 
 
{-------------------------------------------------
 
 
 
------------------------------}
{ Selection de l'élement a créer   point, ligne, cercle }
{-------------------------------------------------------------------------------}
 
procedure TFdesigner.BtEditerClick(Sender: TObject);
var ObjGraphique : TpointG;
 
begin
  Case RadioGroup1.ItemIndex of
   0 : //Selection de point
       ObjGraphique := TpointG.Init (-5,-5,clBlack );
   1 : //Selection de Ligne
       ObjGraphique := TLigne.Init (-5,-5,-5,-5,clBlack );
   2 : //Selection de Cercle
       ObjGraphique := TCercle.Init (-5,-5,-5,-5,clBlack );
  end; // du case
 
  ListeObjGraph.Add (ObjGraphique);
  ObjGraphique.edition;
  ObjGraphique.affiche;
end;
 
 
{-------------------------------------------------
 
 
 
------------------------------}
{ Affichage des objets dans une liste }
{-------------------------------------------------------------------------------} 
 [edtdd]--Message édité par Break-out--[/edtdd]