This example effect chart:
Code files:Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs;
Type
TForm1 = Class (Tform)
Procedure Formcreate (Sender:tobject);
Procedure Formdestroy (Sender:tobject);
Procedure Formpaint (Sender:tobject);
Procedure Formmousemove (Sender:tobject; Shift:tshiftstate; X, Y:integer);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Uses Gdipobj, GDIPAPI;
Var
Path1,path2,path3:tgpgraphicspath;
P:tgppen;
Procedure Tform1.formcreate (Sender:tobject);
Var
R:trect;
Begin
path1: = tgpgraphicspath.create;
path2: = tgpgraphicspath.create;
Path3: = tgpgraphicspath.create;
P: = Tgppen.create (aclred, 3);
Path1. AddLine (0, 0, clientwidth, clientheight);
r: = Clientrect;
Inflaterect (R,-clientwidth Div 3,-clientheight Div 3);
Offsetrect (R,-trunc (r.right-r.left) * 0.6),-trunc ((r.bottom-r.top) * 0.6));
Path2. AddRectangle (Makerect (R));
Offsetrect (R, R.right-r.left, R.bottom-r.top);
Path3. AddEllipse (Makerect (R));
End
Procedure Tform1.formdestroy (Sender:tobject);
Begin
Path1. Free;
Path2. Free;
Path3. Free;
P.free;
End
Procedure Tform1.formpaint (Sender:tobject);
Var
G:tgpgraphics;
Begin
G: = Tgpgraphics.create (Canvas.handle);
G.drawpath (P, path1);
G.drawpath (P, path2);
G.drawpath (P, path3);
G.free;
End
Procedure Tform1.formmousemove (Sender:tobject; Shift:tshiftstate; X
Y:integer);
Begin
Text: = ';
If path1. IsVisible (Makepoint (x,y)) then Text: = ' within path1 ';
If path2. IsVisible (Makepoint (x,y)) then Text: = ' within the rectangle ';
If Path3. IsVisible (Makepoint (x,y)) then Text: = ' in Ellipse ';
If path1. Isoutlinevisible (X, Y, p) then Text: = ' on line ';
If path2. Isoutlinevisible (X, Y, p) then Text: = ' on the edge of the rectangle ';
If Path3. Isoutlinevisible (X, Y, p) then Text: = ' on the circular line of the ellipse ';
End
End.
Form file:object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 206
ClientWidth = 339
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poDesktopCenter
OnCreate = FormCreate
OnDestroy = FormDestroy
OnMouseMove = FormMouseMove
OnPaint = FormPaint
PixelsPerInch = 96
TextHeight = 13
end