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;
var pts:array[0..6] of Tgppoint;
Procedure Tform1.formcreate (Sender:tobject);
Begin
Pts[0]. X: = 10; Pts[0]. Y: = 50;
PTS[1]. X: = 40; PTS[1]. Y: = 90;
PTS[2]. X: = 80; PTS[2]. Y: = 10;
PTS[3]. X: = 110; PTS[3]. Y: = 50;
PTS[4]. X: = 140; PTS[4]. Y: = 10;
PTS[5]. X: = 180; PTS[5]. Y: = 90;
PTS[6]. X: = 210; PTS[6]. Y: = 50;
Checkbox1.caption: = ' Flip the point in the path ';
Checkbox2.caption: = ' Empty the point in the path ';
End
Procedure Tform1.formpaint (Sender:tobject);
Var
G:tgpgraphics;
P:tgppen;
Path:tgpgraphicspath;
Pathpts:array of Tgppoint;
I:integer;
Begin
G: = Tgpgraphics.create (Canvas.handle);
P: = Tgppen.create (aclred, 2);
Path: = Tgpgraphicspath.create;
Path. AddBeziers (Pgppoint (@pts), Length (pts));
If checkbox1.checked then path. Reverse;
If checkbox2.checked then path. Reset;
{When Reset, the pathpoints and pathtypes arrays are emptied and the Fillmode is set to Fillmodealternate}
SetLength (pathpts, path.) Getpointcount);
Path. Getpathpoints (Pgppoint (pathpts), Length (pathpts));
Canvas.Pen.Color: = Clgray;
For I: = Low (pathpts) to High (pathpts) do
Canvas.textout (Pathpts[i]. X, Pathpts[i]. Y, IntToStr (i+1));
G.drawpath (P, path);
Path. Free;
P.free;
G.free;
End
Procedure Tform1.checkbox1click (Sender:tobject);
Begin
Repaint;
End
Procedure Tform1.checkbox2click (Sender:tobject);
Begin
Repaint;
End
End.