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
| Program Ligne;
Uses WinTypes, WinProcs, OWindows;
Type pFenetrePrincipale = ^tFenetrePrincipale;
tFenetrePrincipale = Object(tWindow)
x1, y1, x2, y2 : Integer; (* Coordonnées de la ligne *)
Procedure SetupWindow; virtual;
Procedure Paint (PaintDC : hDC; var PaintInfo : tPaintStruct); virtual;
end;
tProgramme = Object(tApplication)
Procedure InitMainWindow; virtual;
end;
Procedure tFenetrePrincipale.SetupWindow;
(* Initialisation des champs x1, y1; x2 et y2 *)
Begin
tWindow.SetupWindow;
x1 := 10;
y1 := 20;
x2 := 200;
y2 := 160;
End;
Procedure tFenetrePrincipale.Paint (PaintDC : hDC; var PaintInfo : tPaintStruct);
(* Dessin de la ligne *)
Begin
MoveTo(PaintDC,x1,y1);
LineTo(PaintDC,x2,y2);
End;
Procedure tProgramme.InitMainWindow;
Begin
MainWindow := New(pFenetrePrincipale,Init(Nil,'Dessin de ligne'));
End;
Var Programme : tProgramme;
Begin
Programme.Init('Ligne');
Programme.Run;
Programme.Done;
End. |
Partager