This example effect chart:
Code files:Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs, Stdctrls;
Type
TForm1 = Class (Tform)
Checkbox1:tcheckbox;
Checkbox2:tcheckbox;
Procedure Formcreate (Sender:tobject);
Procedure Formpaint (Sender:tobject);
Procedure Checkbox1click (Sender:tobject);
Procedure Checkbox2click (Sender:tobject);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Uses Gdipobj, GDIPAPI;
Procedure Tform1.formcreate (Sender:tobject);
Begin
Checkbox1.caption: = ' closefigure ';
Checkbox2.caption: = ' closeallfigures ';
End
Procedure Tform1.formpaint (Sender:tobject);
Var
G:tgpgraphics;
Path:tgpgraphicspath;
P:tgppen;
B:tgpbrush;
PTS1,PTS2,PTS3:ARRAY[0..2] of Tgppoint;
I:integer;
Begin
Pts1[0]: = Makepoint (0, 30);
PTS1[1]: = Makepoint (30, 0);
PTS1[2]: = Makepoint (60, 30);
For I: = 0 to Length (pts1) do
Begin
Pts2[i]. X: = Pts1[i]. X + 80;
Pts2[i]. Y: = Pts1[i]. Y + 20;
Pts3[i]. X: = Pts2[i]. X + 80;
Pts3[i]. Y: = Pts2[i]. Y + 20;
End
G: = Tgpgraphics.create (Canvas.handle);
Path: = Tgpgraphicspath.create;
Path. Startfigure;
Path. AddLines (Pgppoint (@pts1), Length (PTS1));
Path. Startfigure;
Path. AddLines (Pgppoint (@pts2), Length (pts2));
Path. Startfigure;
Path. AddLines (Pgppoint (@pts3), Length (PTS3));
If checkbox1.checked then path. Closefigure;
If checkbox2.checked then path. Closeallfigures;
P: = Tgppen.create (aclred, 2);
B: = Tgpsolidbrush.create (Aclyellow);
G.drawpath (P, path);
B.free;
P.free;
Path. Free;
G.free;
End
Procedure Tform1.checkbox1click (Sender:tobject);
Begin
Repaint;
End
Procedure Tform1.checkbox2click (Sender:tobject);
Begin
Repaint;
End
End.