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)
Buttoncolor1:tbuttoncolor;
Buttoncolor2:tbuttoncolor;
Procedure Formcreate (Sender:tobject);
Procedure Formpaint (Sender:tobject);
Procedure Buttoncolor1click (Sender:tobject);
Procedure Buttoncolor2click (Sender:tobject);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Uses Gdipobj, GDIPAPI;
Procedure Tform1.formcreate (Sender:tobject);
Begin
Buttoncolor1.caption: = ' Center color ';
Buttoncolor2.caption: = ' peripheral color ';
Buttoncolor1.symbolcolor: = Cllime;
End
Procedure Tform1.formpaint (Sender:tobject);
Var
G:tgpgraphics;
Rect:tgprect;
Path:tgpgraphicspath;
Pb:tgppathgradientbrush;
colorarr:array[0..0] of Tgpcolor;
Num:integer;
Begin
Rect: = Makerect (A, ClientWidth-40, ClientHeight-50);
G: = Tgpgraphics.create (Canvas.handle);
Path: = Tgpgraphicspath.create;
Path. AddEllipse (rect);
PB: = tgppathgradientbrush.create (path);
Pb. Setcentercolor (Colorreftoargb (Buttoncolor1.symbolcolor));
Colorarr[0]: = Colorreftoargb (Buttoncolor2.symbolcolor);
num: = 1;
Pb. Setsurroundcolors (Pargb (@ColorArr), num);
G.fillellipse (Pb, Rect);
Pb. Free;
Path. Free;
G.free;
End
Procedure Tform1.buttoncolor1click (Sender:tobject);
Begin
Repaint;
End
Procedure Tform1.buttoncolor2click (Sender:tobject);
Begin
Repaint;
End
End.