In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, extctrls; Type tform1 = Class (tform) Procedure formpaint (Sender: tobject); Procedure formcreate (Sender: tobject); Procedure formdestroy (Sender: tobject); Procedure formmousemove (Sender: tobject; shift: tshiftstate; X, Y: integer); end; vaR form1: tform1; implementation {$ R *. DFM} uses gdipobj, gdipapi; var RGN: tgpregion; Procedure future (Sender: tobject); var RT: trect; Path: tgpgraphicspath; begin RT: = clientrect; inflaterect (RT, -20,-20); {create region} RGN: = tgpregion. create (makerect (RT); {build path} inflaterect (RT,-2,-2); Path: = tgpgraphicspath. create; Path. addellipse (makerect (RT); {subtract path from Region} RGN. exclude (PATH); Path. free; end; Procedure tform1.formdestroy (Sender: tobject); begin RGN. free; end; Procedure tform1.formpaint (Sender: tobject); var G: tgpgraphics; B: tgpbrush; begin G: = tgpgraphics. create (canvas. handle); B: = tgphatchbrush. create (hatchstylemin, aclsilver, aclred); G. fillregion (B, RGN); B. free; G. free; end; Procedure tform1.formmousemove (Sender: tobject; shift: tshiftstate; X, Y: integer); begin text: = 'form1 '; If RGN. isvisible (x, y) then text: = 'in the region'; end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 129 clientwidth = 177 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = podesktopcenter oncreate = formcreate ondestroy = formdestroy onmousemove = formmousemove onpaint = formpaint pixelsperinch = 96 textheight = 13end