Learn more about GDI + [26]: tgppen-brush alignment

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) radiogroup1: tradiogroup; procedure formpaint (Sender: tobject); Procedure formcreate (Sender: tobject); Procedure radiogroup1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses gdipobj, gdipapi; Procedure tform1.formcreate (Sender: tobject); begin with radiogroup1 do begin align: = Albottom; items. add ('penalignmentcenter'); items. add ('penalignmentinset'); columns: = 2; itemindex: = 0; end; Procedure tform1.formpaint (Sender: tobject); var G: tgpgraphics; P: tgppen; rect: trect; begin G: = tgpgraphics. create (canvas. handle); G. clear ($ ffffffff); P: = tgppen. create ($ ffee82ee, 20); rect: = clientrect; inflaterect (rect,-50,-50); offsetrect (rect, 0,-20); p. setalignment (tpenalignment (radiogroup1.itemindex); G. drawrectangle (p, makerect (rect); p. setcolor ($ ff000000); p. setwidth (1.5); G. drawrectangle (p, makerect (rect); p. free; G. free; end; Procedure tform1.radiogroup1click (Sender: tobject); begin repaint; end.
 
   
 

Form file:

 
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 198 clientwidth = 277 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 radiogroup1: tradiogroup left = 8 Top = 152 width = 185 Height = 38 caption = 'radiogroup1' taborder = 0 onclick = radiogroup1click endend

  

Brush alignment:

Delphi Microsoft Description
Penalignmentcenter Center Specify the pen object to be centered on the theoretical line.
Penalignmentinset Inset Specify the pen to be positioned in the theoretical line.
No definition Left Specifies the position of the pen on the left side of the theoretical line.
No definition Outset Specify to position the pen outside the theoretical line.
No definition Right Specifies that the pen is positioned on the right of the theoretical line.

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.