In this example:
Code File:
Unit unit1; interfaceuses 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); {in this case, the center is set to white by default. In the following example, the center is black by default.} Pb: = tgppathgradientbrush. create (pgppoint (@ PTS), length (PTS); {create path painter Based on the Dot Array} Pb. setcentercolor (aclwhite); num: = length (PTS); Pb. setsurroundcolors (pargb (@ colorarr), num); G. fillpath (Pb, PATH); {use the Grayscale Correction mode to draw another image} Pb. setgammacorrection (true); G. translatetransform (150, 0); G. fillpath (Pb, PATH); Pb. free; Path. free; G. free; 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 = pow.topcenter onpaint = formpaint pixelsperinch = 96 textheight = 13end