Uses direct2d, d2d1; Procedure tform1.formpaint (Sender: tobject); var CVS: tdirect2dcanvas; ibrush: id2d1radialgradientbrush; R: trect; rrgbp: hidden; // The structure includes: center Point, offset point, transverse radius, longitudinal radius arrgradientstop: array [0 .. 1] of td2d1gradientstop; igradientstops: id2d1gradientstopcollection; begin CVS: = tdirect2dcanvas. create (canvas, clientrect); R: = clientrect; inflaterect (R,-clientwidth Div 6,-clientheight Div 6); rrgbp. center: = d2d1pointf (clientwidth/2, clientheight/2); rrgbp. gradientoriginoffset: = d2d1pointf (0, 0); rrgbp. radiusx: = (R. right-R. left)/2; rrgbp. radiusy: = (R. bottom-R. top)/2; arrgradientstop [0]. position: = 0.0; arrgradientstop [0]. color: = d2d1colgrading (clyellow); arrgradientstop [1]. position: = 1.0; arrgradientstop [1]. color: = d2d1colgrading (clred); CVs. rendertarget. creategradientstopcollection (@ arrgradientstop [0], length (arrgradientstop), d2d1_gamma_2_2, d2d1_extend_mode_clamp, igradientstops); CVs. rendertarget. createradialgradientbrush (rrgbp, nil, igradientstops, ibrush); CVs. brush. handle: = ibrush; CVs. pen. width: = 0; CVs. begindraw; CVs. ellipse (r); CVs. enddraw; CVs. free; end; Procedure tform1.formresize (Sender: tobject); begin repaint; end;
: