Learn more about GDI + [74]: Region (3)-isvisible

Source: Internet
Author: User
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

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.