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. |