This example effect chart:
Code files:Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs, Stdctrls, Extctrls;
Type
TForm1 = Class (Tform)
Procedure Formpaint (Sender:tobject);
Procedure Formcreate (Sender:tobject);
Procedure Formdestroy (Sender:tobject);
Procedure Formmousemove (Sender:tobject; Shift:tshiftstate; X, Y:integer);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Uses Gdipobj, GDIPAPI;
var rgn:tgpregion;
Procedure Tform1.formcreate (Sender:tobject);
Var
Rt:trect;
Path:tgpgraphicspath;
Begin
RT: = Clientrect;
Inflaterect (RT,-20,-20);
{Create Zone}
Rgn: = Tgpregion.create (Makerect (RT));
{Create path}
Inflaterect (RT,-2,-2);
Path: = Tgpgraphicspath.create;
Path. AddEllipse (Makerect (RT));
{Subtract the path from the zone}
Rgn. Exclude (path);
Path. Free;
End
Procedure Tform1.formdestroy (Sender:tobject);
Begin
Rgn. Free;
End
Procedure Tform1.formpaint (Sender:tobject);
Var
G:tgpgraphics;
B:tgpbrush;
Begin
G: = Tgpgraphics.create (Canvas.handle);
B: = Tgphatchbrush.create (Hatchstylemin, Aclsilver, aclred);
G.fillregion (b, RGN);
B.free;
G.free;
End
Procedure Tform1.formmousemove (Sender:tobject; Shift:tshiftstate; X
Y:integer);
Begin
Text: = ' Form1 ';
If Rgn. IsVisible (X, Y) then Text: = ' in region ';
End
End.
Form file:object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 129
ClientWidth = 177
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