This example effect chart:
Code files:Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs, Stdctrls, Checklst, Extctrls, Tecanvas;
Type
TForm1 = Class (Tform)
Procedure Formcreate (Sender:tobject);
Procedure Formdestroy (Sender:tobject);
Procedure Formpaint (Sender:tobject);
Procedure Formmouseup (Sender:tobject; Button:tmousebutton;
Shift:tshiftstate; X, Y:integer);
Procedure Formmousedown (Sender:tobject; Button:tmousebutton;
Shift:tshiftstate; X, Y:integer);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Uses Gdipobj, GDIPAPI;
Var
Rect:tgprect;
Pt:tgppoint;
Pb:tgppathgradientbrush;
Procedure Tform1.formcreate (Sender:tobject);
Var
Path:tgpgraphicspath;
Colorsurround:tgpcolor; {With only one enclosing color, don't use an array}
Num:integer;
Begin
Rect: = Makerect (Ten, ClientWidth-20, ClientHeight-20);
Path: = Tgpgraphicspath.create;
Path. AddEllipse (rect);
PB: = tgppathgradientbrush.create (path);
Pb. Setcentercolor (Acllime);
Pb. Getcenterpoint (PT);
Colorsurround: = Aclblack;
num: = 1;
Pb. Setsurroundcolors (@ColorSurround, num);
Path. Free;
DoubleBuffered: = True;
End
Procedure Tform1.formdestroy (Sender:tobject);
Begin
Pb. Free;
End
Procedure Tform1.formmousedown (Sender:tobject; Button:tmousebutton;
Shift:tshiftstate; X, Y:integer);
Begin
Pt. x: = x;
Pt. Y: = y;
Repaint;
End
Procedure Tform1.formmouseup (Sender:tobject; Button:tmousebutton;
Shift:tshiftstate; X, Y:integer);
Begin
Repaint;
End
Procedure Tform1.formpaint (Sender:tobject);
Var
G:tgpgraphics;
P:tgppen;
Begin
G: = Tgpgraphics.create (Canvas.handle);
P: = tgppen.create (aclred);
G.fillellipse (Pb, Rect);
Pb. Setcenterpoint (PT);
G.drawrectangle (P, Pt. X-3, Pt. Y-3, 6, 6);
P.free;
G.free;
End
End.
Form file:object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 164
ClientWidth = 208
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
OnMouseDown = FormMouseDown
OnMouseUp = FormMouseUp
OnPaint = FormPaint
PixelsPerInch = 96
TextHeight = 13
end