In this example:
Code File:
Unit unit1; interfaceuses windows, messages, extensions, variants, classes, graphics, controls, forms, dialogs, extctrls; Type tform1 = Class (tform) timer1: ttimer; Procedure formpaint (Sender: tobject); Procedure timer1timer (Sender: tobject); Procedure formcreate (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses gdipobj, gdipapi; var N: integer; Procedure tform1.formcreate (Sender: tobject); begin timer1.interval: = 100; end; Procedure destroy (Sender: tobject); var G: tgpgraphics; P: tgppen; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (aclchocolate, 8); p. setdashstyle (dashstyledashdotdot); p. setdashoffset (n); G. drawline (p, clientwidth Div 2, clientheight Div 2, 0, 0); G. drawline (p, clientwidth Div 2, clientheight Div 2, clientwidth Div 2, 0); G. drawline (p, clientwidth Div 2, clientheight Div 2, clientwidth, 0); G. drawline (p, clientwidth Div 2, clientheight Div 2, clientwidth, clientheight Div 2); G. drawline (p, clientwidth Div 2, clientheight Div 2, clientwidth, clientheight); G. drawline (p, clientwidth Div 2, clientheight Div 2, clientwidth Div 2, clientheight); G. drawline (p, clientwidth Div 2, clientheight Div 2, 0, clientheight); G. drawline (p, clientwidth Div 2, clientheight Div 2, 0, clientheight Div 2); Dec (n); if n> SQRT (sqr (clientwidth) + sqr (clientwidth )) then N: = 0; p. free; G. free; end; Procedure tform1.timer1timer (Sender: tobject); begin repaint; end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 167 clientwidth = 242 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = pow.topcenter oncreate = formcreate onpaint = formpaint pixelsperinch = 96 textheight = 13 object timer1: ttimer ontimer = timer1timer left = 112 Top = 88 endend