This example effect chart:
Code files:Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs;
Type
TForm1 = Class (Tform)
Procedure Formpaint (Sender:tobject);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Uses Gdipobj, GDIPAPI;
Procedure Tform1.formpaint (Sender:tobject);
Const
COLORARR:ARRAY[0..2] of Tgpcolor = (aclred, Aclgreen, Aclblue);
Var
PTS:ARRAY[0..2] of Tgppoint;
G:tgpgraphics;
Path:tgpgraphicspath;
Pb:tgppathgradientbrush;
Num:integer;
Begin
Pts[0]: = Makepoint (80, 10);
PTS[1]: = Makepoint (10, 150);
PTS[2]: = Makepoint (150, 150);
G: = Tgpgraphics.create (Canvas.handle);
Path: = Tgpgraphicspath.create;
Path. Addpolygon (Pgppoint (@pts), Length (pts));
PB: = tgppathgradientbrush.create (path); {This establishes the center default white; Press the center default black}
PB: = Tgppathgradientbrush.create (Pgppoint (@pts), Length (pts)); {Create a path based on an array of points draw the brush}
Pb. Setcentercolor (Aclwhite);
Num: = Length (pts);
Pb. Setsurroundcolors (Pargb (@ColorArr), num);
G.fillpath (Pb, Path);
{Use grayscale correction mode for another place to draw again}
Pb. Setgammacorrection (True);
G.translatetransform (150, 0);
G.fillpath (Pb, Path);
Pb. Free;
Path. Free;
G.free;
End
End.
Form file:object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 163
ClientWidth = 311
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poDesktopCenter
OnPaint = FormPaint
PixelsPerInch = 96
TextHeight = 13
end