examples: redo pen and brush example

git-svn-id: trunk@17353 -
This commit is contained in:
paul 2008-11-12 10:11:56 +00:00
parent 12dbeac781
commit ef3c142897
3 changed files with 471 additions and 219 deletions
examples/pen_brush

View File

@ -1,130 +1,196 @@
object Form1: TForm1
Left = 350
Height = 525
Height = 492
Top = 215
Width = 442
Caption = 'Pen & Brush'
ClientHeight = 525
ClientWidth = 442
Width = 440
AutoSize = True
Caption = 'Pen and Brush'
ClientHeight = 492
ClientWidth = 440
OnCreate = FormCreate
OnDestroy = FormDestroy
ParentFont = False
Position = poScreenCenter
LCLVersion = '0.9.27'
object Label1: TLabel
object PaintBox: TPaintBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 11
Height = 14
Top = 11
Width = 28
BorderSpacing.Left = 11
BorderSpacing.Top = 11
Caption = 'Pens:'
ParentColor = False
end
object PenBox: TPaintBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 11
Height = 153
Top = 32
Width = 420
Height = 169
Top = 7
Width = 418
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 11
BorderSpacing.Top = 7
BorderSpacing.Right = 11
OnPaint = PenBoxPaint
end
object Label2: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CapsCombo
AnchorSideTop.Side = asrBottom
Left = 11
Height = 14
Top = 252
Width = 43
BorderSpacing.Left = 11
BorderSpacing.Top = 11
Caption = 'Brushes:'
ParentColor = False
end
object BrushBox: TPaintBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 11
Height = 207
Top = 273
Width = 420
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 11
BorderSpacing.Top = 7
BorderSpacing.Right = 11
OnPaint = BrushBoxPaint
OnPaint = PaintBoxPaint
end
object Label3: TLabel
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = WidthCombo
AnchorSideTop.Side = asrCenter
Left = 152
Left = 18
Height = 14
Top = 195
Top = 263
Width = 33
BorderSpacing.Left = 7
Caption = 'Width:'
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = PenBox
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = CapsCombo
AnchorSideTop.Side = asrCenter
Left = 11
Left = 18
Height = 14
Top = 223
Top = 320
Width = 50
BorderSpacing.Left = 7
Caption = 'End Caps:'
ParentColor = False
end
object Label5: TLabel
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = JoinCombo
AnchorSideTop.Side = asrCenter
Left = 152
Left = 18
Height = 14
Top = 223
Top = 348
Width = 51
BorderSpacing.Left = 7
Caption = 'Join Style:'
ParentColor = False
end
object Label6: TLabel
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = PenColorBox
AnchorSideTop.Side = asrCenter
Left = 296
Left = 18
Height = 14
Top = 196
Top = 292
Width = 30
BorderSpacing.Left = 7
Caption = 'Color:'
ParentColor = False
end
object Bevel1: TBevel
AnchorSideLeft.Control = Label1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 82
Height = 3
Top = 217
Width = 347
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
BorderSpacing.Right = 11
end
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = FigureCombo
AnchorSideTop.Side = asrBottom
Left = 11
Height = 14
Top = 211
Width = 61
BorderSpacing.Left = 11
BorderSpacing.Top = 7
Caption = 'Pen options:'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = JoinCombo
AnchorSideTop.Side = asrBottom
Left = 11
Height = 14
Top = 373
Width = 70
BorderSpacing.Left = 11
BorderSpacing.Top = 7
Caption = 'Brush options:'
ParentColor = False
end
object Bevel2: TBevel
AnchorSideLeft.Control = Bevel1
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 82
Height = 3
Top = 379
Width = 347
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 11
end
object Label7: TLabel
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = PenStyleCombo
AnchorSideTop.Side = asrCenter
Left = 18
Height = 14
Top = 235
Width = 29
BorderSpacing.Left = 7
Caption = 'Style:'
ParentColor = False
end
object Label8: TLabel
AnchorSideLeft.Control = Label2
AnchorSideTop.Control = BrushStyleCombo
AnchorSideTop.Side = asrCenter
Left = 18
Height = 14
Top = 397
Width = 29
BorderSpacing.Left = 7
Caption = 'Style:'
ParentColor = False
end
object Label9: TLabel
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = BrushColorBox
AnchorSideTop.Side = asrCenter
Left = 18
Height = 14
Top = 426
Width = 30
BorderSpacing.Left = 7
Caption = 'Color:'
ParentColor = False
end
object Label10: TLabel
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = FigureCombo
AnchorSideTop.Side = asrCenter
Left = 18
Height = 14
Top = 186
Width = 35
BorderSpacing.Left = 7
Caption = 'Figure:'
ParentColor = False
end
object Button1: TBitBtn
AnchorSideTop.Control = BrushBox
AnchorSideTop.Control = BrushColorBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 342
Left = 340
Height = 26
Top = 488
Top = 455
Width = 89
Anchors = [akRight, akBottom]
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 11
BorderSpacing.Right = 11
BorderSpacing.Bottom = 11
BorderSpacing.Around = 11
Caption = '&Закрыть'
Kind = bkClose
NumGlyphs = 0
@ -132,12 +198,14 @@ object Form1: TForm1
TabOrder = 0
end
object WidthCombo: TComboBox
AnchorSideTop.Control = PenBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = PenStyleCombo
AnchorSideTop.Side = asrBottom
Left = 216
Left = 100
Height = 21
Top = 192
Width = 70
Top = 260
Width = 110
BorderSpacing.Left = 100
BorderSpacing.Top = 7
ItemHeight = 13
ItemIndex = 0
@ -150,18 +218,20 @@ object Form1: TForm1
'6'
'7'
)
OnChange = WidthComboChange
OnChange = PenChange
Style = csDropDownList
TabOrder = 1
Text = '1'
end
object CapsCombo: TComboBox
AnchorSideTop.Control = WidthCombo
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = PenColorBox
AnchorSideTop.Side = asrBottom
Left = 75
Left = 100
Height = 21
Top = 220
Width = 70
Top = 317
Width = 110
BorderSpacing.Left = 100
BorderSpacing.Top = 7
ItemHeight = 13
ItemIndex = 0
@ -170,17 +240,21 @@ object Form1: TForm1
'Square'
'Flat'
)
OnChange = WidthComboChange
OnChange = PenChange
Style = csDropDownList
TabOrder = 2
Text = 'Round'
end
object JoinCombo: TComboBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CapsCombo
Left = 216
AnchorSideTop.Side = asrBottom
Left = 100
Height = 21
Top = 220
Width = 70
Top = 345
Width = 110
BorderSpacing.Left = 100
BorderSpacing.Top = 7
ItemHeight = 13
ItemIndex = 0
Items.Strings = (
@ -188,35 +262,110 @@ object Form1: TForm1
'Bevel'
'Mitter'
)
OnChange = WidthComboChange
OnChange = PenChange
Style = csDropDownList
TabOrder = 3
Text = 'Round'
end
object GeometricCheck: TCheckBox
AnchorSideLeft.Control = PenBox
AnchorSideLeft.Control = WidthCombo
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = WidthCombo
AnchorSideTop.Side = asrCenter
Left = 11
Left = 217
Height = 19
Top = 193
Top = 261
Width = 74
BorderSpacing.Left = 7
Caption = 'Geometric'
OnChange = WidthComboChange
OnChange = PenChange
ParentBidiMode = False
TabOrder = 4
end
object PenColorBox: TColorBox
AnchorSideTop.Control = PenBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = WidthCombo
AnchorSideTop.Side = asrBottom
Left = 336
Left = 100
Height = 22
Top = 192
Width = 96
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbPrettyNames]
Top = 288
Width = 110
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbCustomColor, cbPrettyNames]
BorderSpacing.Left = 100
BorderSpacing.Top = 7
ItemHeight = 16
OnChange = WidthComboChange
OnChange = PenChange
TabOrder = 5
end
object PenStyleCombo: TComboBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
Left = 100
Height = 21
Top = 232
Width = 110
BorderSpacing.Left = 100
BorderSpacing.Top = 7
ItemHeight = 13
OnChange = PenChange
Style = csDropDownList
TabOrder = 6
end
object BrushStyleCombo: TComboBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
Left = 100
Height = 21
Top = 394
Width = 110
BorderSpacing.Left = 100
BorderSpacing.Top = 7
ItemHeight = 13
MaxLength = -1
OnChange = BrushChange
Style = csDropDownList
TabOrder = 7
end
object BrushColorBox: TColorBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = BrushStyleCombo
AnchorSideTop.Side = asrBottom
Left = 100
Height = 22
Top = 422
Width = 110
Selected = clBtnFace
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbCustomColor, cbPrettyNames]
BorderSpacing.Left = 100
BorderSpacing.Top = 7
ItemHeight = 16
OnChange = BrushChange
TabOrder = 8
end
object FigureCombo: TComboBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = PaintBox
AnchorSideTop.Side = asrBottom
Left = 100
Height = 21
Top = 183
Width = 110
BorderSpacing.Left = 100
BorderSpacing.Top = 7
ItemHeight = 13
ItemIndex = 0
Items.Strings = (
'Line'
'PolyLine'
'Ellipse'
'Rectangle'
'Triangle'
)
OnChange = FigureComboChange
Style = csDropDownList
TabOrder = 9
Text = 'Line'
end
end

View File

@ -1,70 +1,119 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'^'#1#6'Height'#3#13#2#3'Top'#3#215#0#5'Wi'
+'dth'#3#186#1#7'Caption'#6#11'Pen & Brush'#12'ClientHeight'#3#13#2#11'Client'
+'Width'#3#186#1#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'
+#10'ParentFont'#8#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.27'
+#0#6'TLabel'#6'Label1'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTo'
+'p.Control'#7#5'Owner'#4'Left'#2#11#6'Height'#2#14#3'Top'#2#11#5'Width'#2#28
+#18'BorderSpacing.Left'#2#11#17'BorderSpacing.Top'#2#11#7'Caption'#6#5'Pens:'
+#11'ParentColor'#8#0#0#9'TPaintBox'#6'PenBox'#22'AnchorSideLeft.Control'#7#5
+'Owner'#21'AnchorSideTop.Control'#7#6'Label1'#18'AnchorSideTop.Side'#7#9'asr'
+'Bottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9
+'asrBottom'#4'Left'#2#11#6'Height'#3#153#0#3'Top'#2' '#5'Width'#3#164#1#7'An'
+'chors'#11#5'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.Left'#2#11#17'Bo'
+'rderSpacing.Top'#2#7#19'BorderSpacing.Right'#2#11#7'OnPaint'#7#11'PenBoxPai'
+'nt'#0#0#6'TLabel'#6'Label2'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anchor'
+'SideTop.Control'#7#9'CapsCombo'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Lef'
+'t'#2#11#6'Height'#2#14#3'Top'#3#252#0#5'Width'#2'+'#18'BorderSpacing.Left'#2
+#11#17'BorderSpacing.Top'#2#11#7'Caption'#6#8'Brushes:'#11'ParentColor'#8#0#0
+#9'TPaintBox'#8'BrushBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSid'
+'eTop.Control'#7#6'Label2'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSi'
+'deRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'
+#2#11#6'Height'#3#207#0#3'Top'#3#17#1#5'Width'#3#164#1#7'Anchors'#11#5'akTop'
+#6'akLeft'#7'akRight'#0#18'BorderSpacing.Left'#2#11#17'BorderSpacing.Top'#2#7
+#19'BorderSpacing.Right'#2#11#7'OnPaint'#7#13'BrushBoxPaint'#0#0#6'TLabel'#6
+'Label3'#21'AnchorSideTop.Control'#7#10'WidthCombo'#18'AnchorSideTop.Side'#7
+#9'asrCenter'#4'Left'#3#152#0#6'Height'#2#14#3'Top'#3#195#0#5'Width'#2'!'#7
+'Caption'#6#6'Width:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#22'AnchorSid'
+'eLeft.Control'#7#6'PenBox'#21'AnchorSideTop.Control'#7#9'CapsCombo'#18'Anch'
+'orSideTop.Side'#7#9'asrCenter'#4'Left'#2#11#6'Height'#2#14#3'Top'#3#223#0#5
+'Width'#2'2'#7'Caption'#6#9'End Caps:'#11'ParentColor'#8#0#0#6'TLabel'#6'Lab'
+'el5'#21'AnchorSideTop.Control'#7#9'JoinCombo'#18'AnchorSideTop.Side'#7#9'as'
+'rCenter'#4'Left'#3#152#0#6'Height'#2#14#3'Top'#3#223#0#5'Width'#2'3'#7'Capt'
+'ion'#6#11'Join Style:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label6'#21'AnchorS'
+'ideTop.Control'#7#11'PenColorBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'L'
+'eft'#3'('#1#6'Height'#2#14#3'Top'#3#196#0#5'Width'#2#30#7'Caption'#6#6'Colo'
+'r:'#11'ParentColor'#8#0#0#7'TBitBtn'#7'Button1'#21'AnchorSideTop.Control'#7
+#8'BrushBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Contro'
+'l'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.C'
+'ontrol'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3'V'#1#6
+'Height'#2#26#3'Top'#3#232#1#5'Width'#2'Y'#7'Anchors'#11#7'akRight'#8'akBott'
+'om'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2#11#19'BorderSpacing.Right'#2#11
+#20'BorderSpacing.Bottom'#2#11#7'Caption'#6#15'&'#208#151#208#176#208#186#209
+#128#209#139#209#130#209#140#4'Kind'#7#7'bkClose'#9'NumGlyphs'#2#0#7'OnClick'
+#7#12'Button1Click'#8'TabOrder'#2#0#0#0#9'TComboBox'#10'WidthCombo'#21'Ancho'
+'rSideTop.Control'#7#6'PenBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'
+#3#216#0#6'Height'#2#21#3'Top'#3#192#0#5'Width'#2'F'#17'BorderSpacing.Top'#2
+#7#10'ItemHeight'#2#13#9'ItemIndex'#2#0#13'Items.Strings'#1#6#1'1'#6#1'2'#6#1
+'3'#6#1'4'#6#1'5'#6#1'6'#6#1'7'#0#8'OnChange'#7#16'WidthComboChange'#5'Style'
+#7#14'csDropDownList'#8'TabOrder'#2#1#4'Text'#6#1'1'#0#0#9'TComboBox'#9'Caps'
+'Combo'#21'AnchorSideTop.Control'#7#10'WidthCombo'#18'AnchorSideTop.Side'#7#9
+'asrBottom'#4'Left'#2'K'#6'Height'#2#21#3'Top'#3#220#0#5'Width'#2'F'#17'Bord'
+'erSpacing.Top'#2#7#10'ItemHeight'#2#13#9'ItemIndex'#2#0#13'Items.Strings'#1
+#6#5'Round'#6#6'Square'#6#4'Flat'#0#8'OnChange'#7#16'WidthComboChange'#5'Sty'
+'le'#7#14'csDropDownList'#8'TabOrder'#2#2#4'Text'#6#5'Round'#0#0#9'TComboBox'
+#9'JoinCombo'#21'AnchorSideTop.Control'#7#9'CapsCombo'#4'Left'#3#216#0#6'Hei'
+'ght'#2#21#3'Top'#3#220#0#5'Width'#2'F'#10'ItemHeight'#2#13#9'ItemIndex'#2#0
+#13'Items.Strings'#1#6#5'Round'#6#5'Bevel'#6#6'Mitter'#0#8'OnChange'#7#16'Wi'
+'dthComboChange'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#3#4'Text'#6#5'R'
+'ound'#0#0#9'TCheckBox'#14'GeometricCheck'#22'AnchorSideLeft.Control'#7#6'Pe'
+'nBox'#21'AnchorSideTop.Control'#7#10'WidthCombo'#18'AnchorSideTop.Side'#7#9
+'asrCenter'#4'Left'#2#11#6'Height'#2#19#3'Top'#3#193#0#5'Width'#2'J'#7'Capti'
+'on'#6#9'Geometric'#8'OnChange'#7#16'WidthComboChange'#14'ParentBidiMode'#8#8
+'TabOrder'#2#4#0#0#9'TColorBox'#11'PenColorBox'#21'AnchorSideTop.Control'#7#6
+'PenBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#3'P'#1#6'Height'#2#22
+#3'Top'#3#192#0#5'Width'#2'`'#5'Style'#11#16'cbStandardColors'#16'cbExtended'
,'Colors'#14'cbSystemColors'#13'cbPrettyNames'#0#17'BorderSpacing.Top'#2#7#10
+'ItemHeight'#2#16#8'OnChange'#7#16'WidthComboChange'#8'TabOrder'#2#5#0#0#0
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'^'#1#6'Height'#3#236#1#3'Top'#3#215#0#5'W'
+'idth'#3#184#1#8'AutoSize'#9#7'Caption'#6#13'Pen and Brush'#12'ClientHeight'
+#3#236#1#11'ClientWidth'#3#184#1#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7
+#11'FormDestroy'#10'ParentFont'#8#8'Position'#7#14'poScreenCenter'#10'LCLVer'
+'sion'#6#6'0.9.27'#0#9'TPaintBox'#8'PaintBox'#22'AnchorSideLeft.Control'#7#5
+'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5
+'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#11#6'Height'#3#169
+#0#3'Top'#2#7#5'Width'#3#162#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0
+#18'BorderSpacing.Left'#2#11#17'BorderSpacing.Top'#2#7#19'BorderSpacing.Righ'
+'t'#2#11#7'OnPaint'#7#13'PaintBoxPaint'#0#0#6'TLabel'#6'Label3'#22'AnchorSid'
+'eLeft.Control'#7#6'Label1'#21'AnchorSideTop.Control'#7#10'WidthCombo'#18'An'
+'chorSideTop.Side'#7#9'asrCenter'#4'Left'#2#18#6'Height'#2#14#3'Top'#3#7#1#5
+'Width'#2'!'#18'BorderSpacing.Left'#2#7#7'Caption'#6#6'Width:'#11'ParentColo'
+'r'#8#0#0#6'TLabel'#6'Label4'#22'AnchorSideLeft.Control'#7#6'Label1'#21'Anch'
+'orSideTop.Control'#7#9'CapsCombo'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'L'
+'eft'#2#18#6'Height'#2#14#3'Top'#3'@'#1#5'Width'#2'2'#18'BorderSpacing.Left'
+#2#7#7'Caption'#6#9'End Caps:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label5'#22
+'AnchorSideLeft.Control'#7#6'Label1'#21'AnchorSideTop.Control'#7#9'JoinCombo'
+#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#18#6'Height'#2#14#3'Top'#3
+'\'#1#5'Width'#2'3'#18'BorderSpacing.Left'#2#7#7'Caption'#6#11'Join Style:'
+#11'ParentColor'#8#0#0#6'TLabel'#6'Label6'#22'AnchorSideLeft.Control'#7#6'La'
+'bel1'#21'AnchorSideTop.Control'#7#11'PenColorBox'#18'AnchorSideTop.Side'#7#9
+'asrCenter'#4'Left'#2#18#6'Height'#2#14#3'Top'#3'$'#1#5'Width'#2#30#18'Borde'
+'rSpacing.Left'#2#7#7'Caption'#6#6'Color:'#11'ParentColor'#8#0#0#6'TBevel'#6
+'Bevel1'#22'AnchorSideLeft.Control'#7#6'Label1'#19'AnchorSideLeft.Side'#7#9
+'asrBottom'#21'AnchorSideTop.Control'#7#6'Label1'#18'AnchorSideTop.Side'#7#9
+'asrCenter'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7
+#9'asrBottom'#4'Left'#2'R'#6'Height'#2#3#3'Top'#3#217#0#5'Width'#3'['#1#7'An'
+'chors'#11#5'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.Left'#2#10#19'Bo'
+'rderSpacing.Right'#2#11#0#0#6'TLabel'#6'Label1'#22'AnchorSideLeft.Control'#7
+#5'Owner'#21'AnchorSideTop.Control'#7#11'FigureCombo'#18'AnchorSideTop.Side'
+#7#9'asrBottom'#4'Left'#2#11#6'Height'#2#14#3'Top'#3#211#0#5'Width'#2'='#18
+'BorderSpacing.Left'#2#11#17'BorderSpacing.Top'#2#7#7'Caption'#6#12'Pen opti'
+'ons:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#22'AnchorSideLeft.Control'#7
+#5'Owner'#21'AnchorSideTop.Control'#7#9'JoinCombo'#18'AnchorSideTop.Side'#7#9
+'asrBottom'#4'Left'#2#11#6'Height'#2#14#3'Top'#3'u'#1#5'Width'#2'F'#18'Borde'
+'rSpacing.Left'#2#11#17'BorderSpacing.Top'#2#7#7'Caption'#6#14'Brush options'
+':'#11'ParentColor'#8#0#0#6'TBevel'#6'Bevel2'#22'AnchorSideLeft.Control'#7#6
+'Bevel1'#21'AnchorSideTop.Control'#7#6'Label2'#18'AnchorSideTop.Side'#7#9'as'
+'rCenter'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9
+'asrBottom'#4'Left'#2'R'#6'Height'#2#3#3'Top'#3'{'#1#5'Width'#3'['#1#7'Ancho'
+'rs'#11#5'akTop'#6'akLeft'#7'akRight'#0#19'BorderSpacing.Right'#2#11#0#0#6'T'
+'Label'#6'Label7'#22'AnchorSideLeft.Control'#7#6'Label1'#21'AnchorSideTop.Co'
+'ntrol'#7#13'PenStyleCombo'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2
+#18#6'Height'#2#14#3'Top'#3#235#0#5'Width'#2#29#18'BorderSpacing.Left'#2#7#7
+'Caption'#6#6'Style:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label8'#22'AnchorSid'
+'eLeft.Control'#7#6'Label2'#21'AnchorSideTop.Control'#7#15'BrushStyleCombo'
+#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#18#6'Height'#2#14#3'Top'#3
+#141#1#5'Width'#2#29#18'BorderSpacing.Left'#2#7#7'Caption'#6#6'Style:'#11'Pa'
+'rentColor'#8#0#0#6'TLabel'#6'Label9'#22'AnchorSideLeft.Control'#7#6'Label1'
+#21'AnchorSideTop.Control'#7#13'BrushColorBox'#18'AnchorSideTop.Side'#7#9'as'
+'rCenter'#4'Left'#2#18#6'Height'#2#14#3'Top'#3#170#1#5'Width'#2#30#18'Border'
+'Spacing.Left'#2#7#7'Caption'#6#6'Color:'#11'ParentColor'#8#0#0#6'TLabel'#7
+'Label10'#22'AnchorSideLeft.Control'#7#6'Label1'#21'AnchorSideTop.Control'#7
+#11'FigureCombo'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#18#6'Height'
+#2#14#3'Top'#3#186#0#5'Width'#2'#'#18'BorderSpacing.Left'#2#7#7'Caption'#6#7
+'Figure:'#11'ParentColor'#8#0#0#7'TBitBtn'#7'Button1'#21'AnchorSideTop.Contr'
+'ol'#7#13'BrushColorBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSide'
+'Right.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'Anchor'
+'SideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'L'
+'eft'#3'T'#1#6'Height'#2#26#3'Top'#3#199#1#5'Width'#2'Y'#7'Anchors'#11#5'akT'
+'op'#7'akRight'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#11#7'Caption'#6#15
+'&'#208#151#208#176#208#186#209#128#209#139#209#130#209#140#4'Kind'#7#7'bkCl'
+'ose'#9'NumGlyphs'#2#0#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#9'T'
,'ComboBox'#10'WidthCombo'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSid'
+'eTop.Control'#7#13'PenStyleCombo'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'L'
+'eft'#2'd'#6'Height'#2#21#3'Top'#3#4#1#5'Width'#2'n'#18'BorderSpacing.Left'#2
+'d'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#13#9'ItemIndex'#2#0#13'Items.'
+'Strings'#1#6#1'1'#6#1'2'#6#1'3'#6#1'4'#6#1'5'#6#1'6'#6#1'7'#0#8'OnChange'#7
+#9'PenChange'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1#4'Text'#6#1'1'#0
+#0#9'TComboBox'#9'CapsCombo'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anchor'
+'SideTop.Control'#7#11'PenColorBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4
+'Left'#2'd'#6'Height'#2#21#3'Top'#3'='#1#5'Width'#2'n'#18'BorderSpacing.Left'
+#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#13#9'ItemIndex'#2#0#13'Item'
+'s.Strings'#1#6#5'Round'#6#6'Square'#6#4'Flat'#0#8'OnChange'#7#9'PenChange'#5
+'Style'#7#14'csDropDownList'#8'TabOrder'#2#2#4'Text'#6#5'Round'#0#0#9'TCombo'
+'Box'#9'JoinCombo'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Co'
+'ntrol'#7#9'CapsCombo'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'd'#6
+'Height'#2#21#3'Top'#3'Y'#1#5'Width'#2'n'#18'BorderSpacing.Left'#2'd'#17'Bor'
+'derSpacing.Top'#2#7#10'ItemHeight'#2#13#9'ItemIndex'#2#0#13'Items.Strings'#1
+#6#5'Round'#6#5'Bevel'#6#6'Mitter'#0#8'OnChange'#7#9'PenChange'#5'Style'#7#14
+'csDropDownList'#8'TabOrder'#2#3#4'Text'#6#5'Round'#0#0#9'TCheckBox'#14'Geom'
+'etricCheck'#22'AnchorSideLeft.Control'#7#10'WidthCombo'#19'AnchorSideLeft.S'
+'ide'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#10'WidthCombo'#18'AnchorSid'
+'eTop.Side'#7#9'asrCenter'#4'Left'#3#217#0#6'Height'#2#19#3'Top'#3#5#1#5'Wid'
+'th'#2'J'#18'BorderSpacing.Left'#2#7#7'Caption'#6#9'Geometric'#8'OnChange'#7
+#9'PenChange'#14'ParentBidiMode'#8#8'TabOrder'#2#4#0#0#9'TColorBox'#11'PenCo'
+'lorBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#10
+'WidthCombo'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'd'#6'Height'#2
+#22#3'Top'#3' '#1#5'Width'#2'n'#5'Style'#11#16'cbStandardColors'#16'cbExtend'
+'edColors'#14'cbSystemColors'#13'cbCustomColor'#13'cbPrettyNames'#0#18'Borde'
+'rSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#16#8'OnChang'
+'e'#7#9'PenChange'#8'TabOrder'#2#5#0#0#9'TComboBox'#13'PenStyleCombo'#22'Anc'
+'horSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#6'Label1'#18'An'
+'chorSideTop.Side'#7#9'asrBottom'#4'Left'#2'd'#6'Height'#2#21#3'Top'#3#232#0
+#5'Width'#2'n'#18'BorderSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'Item'
+'Height'#2#13#8'OnChange'#7#9'PenChange'#5'Style'#7#14'csDropDownList'#8'Tab'
+'Order'#2#6#0#0#9'TComboBox'#15'BrushStyleCombo'#22'AnchorSideLeft.Control'#7
+#5'Owner'#21'AnchorSideTop.Control'#7#6'Label2'#18'AnchorSideTop.Side'#7#9'a'
+'srBottom'#4'Left'#2'd'#6'Height'#2#21#3'Top'#3#138#1#5'Width'#2'n'#18'Borde'
+'rSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#13#9'MaxLeng'
+'th'#2#255#8'OnChange'#7#11'BrushChange'#5'Style'#7#14'csDropDownList'#8'Tab'
+'Order'#2#7#0#0#9'TColorBox'#13'BrushColorBox'#22'AnchorSideLeft.Control'#7#5
+'Owner'#21'AnchorSideTop.Control'#7#15'BrushStyleCombo'#18'AnchorSideTop.Sid'
+'e'#7#9'asrBottom'#4'Left'#2'd'#6'Height'#2#22#3'Top'#3#166#1#5'Width'#2'n'#8
+'Selected'#7#9'clBtnFace'#5'Style'#11#16'cbStandardColors'#16'cbExtendedColo'
+'rs'#14'cbSystemColors'#13'cbCustomColor'#13'cbPrettyNames'#0#18'BorderSpaci'
+'ng.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#16#8'OnChange'#7#11
+'BrushChange'#8'TabOrder'#2#8#0#0#9'TComboBox'#11'FigureCombo'#22'AnchorSide'
+'Left.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#8'PaintBox'#18'AnchorS'
+'ideTop.Side'#7#9'asrBottom'#4'Left'#2'd'#6'Height'#2#21#3'Top'#3#183#0#5'Wi'
+'dth'#2'n'#18'BorderSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeig'
+'ht'#2#13#9'ItemIndex'#2#0#13'Items.Strings'#1#6#4'Line'#6#8'PolyLine'#6#7'E'
+'llipse'#6#9'Rectangle'#6#8'Triangle'#0#8'OnChange'#7#17'FigureComboChange'#5
+'Style'#7#14'csDropDownList'#8'TabOrder'#2#9#4'Text'#6#4'Line'#0#0#0
]);

View File

@ -6,36 +6,45 @@ interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Buttons, ColorBox, LCLIntf;
StdCtrls, ExtCtrls, Buttons, ColorBox, LCLIntf, FPCanvas;
type
{ TForm1 }
TForm1 = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel;
Button1: TBitBtn;
FigureCombo: TComboBox;
Label10: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
BrushColorBox: TColorBox;
PenStyleCombo: TComboBox;
Label1: TLabel;
Label2: TLabel;
PenColorBox: TColorBox;
GeometricCheck: TCheckBox;
Label6: TLabel;
BrushStyleCombo: TComboBox;
WidthCombo: TComboBox;
CapsCombo: TComboBox;
JoinCombo: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
PenBox: TPaintBox;
BrushBox: TPaintBox;
procedure BrushBoxPaint(Sender: TObject);
PaintBox: TPaintBox;
procedure BrushChange(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FigureComboChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure PenBoxPaint(Sender: TObject);
procedure WidthComboChange(Sender: TObject);
procedure PaintBoxPaint(Sender: TObject);
procedure PenChange(Sender: TObject);
private
FPattern: TBitmap;
procedure PenChange;
public
{ public declarations }
end;
@ -55,12 +64,45 @@ begin
Close;
end;
procedure TForm1.FigureComboChange(Sender: TObject);
begin
PaintBox.Invalidate;
end;
procedure TForm1.BrushChange(Sender: TObject);
begin
if BrushStyleCombo.ItemIndex <> -1 then
PaintBox.Canvas.Brush.Style := TBrushStyle(BrushStyleCombo.ItemIndex);
if PaintBox.Canvas.Brush.Style = bsPattern then
PaintBox.Canvas.Brush.Bitmap := FPattern
else
PaintBox.Canvas.Brush.Bitmap := nil;
PaintBox.Invalidate;
end;
procedure TForm1.FormCreate(Sender: TObject);
const
LineBitsDotted: array[0..7] of Word = ($55, $AA, $55, $AA, $55, $AA, $55, $AA);
var
ps: TPenStyle;
bs: TBrushStyle;
begin
FPattern := TBitmap.Create;
FPattern.SetHandles(CreateBitmap(8, 8, 1, 1, @LineBitsDotted), 0);
PenStyleCombo.Items.BeginUpdate;
for ps := Low(ps) to High(ps) do
PenStyleCombo.Items.Add(GetEnumName(TypeInfo(TPenStyle), Ord(ps)));
PenStyleCombo.Items.EndUpdate;
PenStyleCombo.ItemIndex := 0;
BrushStyleCombo.Items.BeginUpdate;
for bs := Low(bs) to High(bs) do
BrushStyleCombo.Items.Add(GetEnumName(TypeInfo(TBrushStyle), Ord(bs)));
BrushStyleCombo.Items.EndUpdate;
BrushStyleCombo.ItemIndex := 0;
end;
procedure TForm1.FormDestroy(Sender: TObject);
@ -68,69 +110,81 @@ begin
FPattern.Free;
end;
procedure TForm1.BrushBoxPaint(Sender: TObject);
var
bs: TBrushStyle;
y: integer;
begin
BrushBox.Canvas.Brush.Bitmap := nil;
y := 15;
for bs := bsSolid to bsDiagCross do
procedure TForm1.PaintBoxPaint(Sender: TObject);
function RandomPoint(R: TRect): TPoint;
begin
BrushBox.Canvas.Brush.Color := clBtnFace;
BrushBox.Canvas.TextOut(10, y - 7, GetEnumName(TypeInfo(TBrushStyle), Ord(bs)));
BrushBox.Canvas.Brush.Color := clRed;
BrushBox.Canvas.Brush.Style := bs;
BrushBox.Canvas.FillRect(120, y - 5, PenBox.Width - 10, y + 5);
inc(y, 15);
Result.x := Random(R.Right - R.Left) + R.Left;
Result.y := Random(R.Bottom - R.Top) + R.Top;
end;
BrushBox.Canvas.Brush.Color := clBtnFace;
BrushBox.Canvas.TextOut(10, y - 7, 'Pattern');
BrushBox.Canvas.Brush.Color := clRed;
BrushBox.Canvas.Brush.Bitmap := FPattern;
BrushBox.Canvas.FillRect(120, y - 5, PenBox.Width - 10, y + 5);
end;
procedure TForm1.PenBoxPaint(Sender: TObject);
var
ps: TPenStyle;
y: integer;
begin
y := 15;
for ps := psSolid to psDashDotDot do
procedure DrawFigure(R: TRect); inline;
var
Points: array of TPoint;
begin
PenBox.Canvas.TextOut(10, y - 7, GetEnumName(TypeInfo(TPenStyle), Ord(ps)));
PenBox.Canvas.Pen.Style := ps;
PenBox.Canvas.Line(120, y, PenBox.Width - 10, y);
inc(y, 15);
inflateRect(R, -10, -10);
case FigureCombo.ItemIndex of
0: // Line
PaintBox.Canvas.Line(R.TopLeft, R.BottomRight);
1: // PolyLine
begin
SetLength(Points, 4);
Points[0] := R.TopLeft;
Points[1] := RandomPoint(R);
Points[2] := RandomPoint(R);
Points[3] := R.BottomRight;
PaintBox.Canvas.Polyline(Points);
end;
2: // Ellipse
PaintBox.Canvas.Ellipse(R);
3: // Rectangle
begin
PaintBox.Canvas.FillRect(R);
PaintBox.Canvas.Rectangle(R);
end;
4: // Triangle
begin
SetLength(Points, 4);
Points[0] := Point(R.Left, R.Bottom);
Points[3] := Points[0];
Points[1] := Point((R.Left + R.Right) div 2, R.Top);
Points[2] := R.BottomRight;
PaintBox.Canvas.Polygon(Points);
end;
end;
end;
PenBox.Canvas.TextOut(10, y - 7, GetEnumName(TypeInfo(TPenStyle), Ord(psClear)));
PenBox.Canvas.Pen.Style := psClear;
PenBox.Canvas.Line(120, y, PenBox.Width - 10, y);
inc(y, 15);
PenBox.Canvas.TextOut(10, y - 7, GetEnumName(TypeInfo(TPenStyle), Ord(psPattern)));
PenBox.Canvas.Pen.Style := psPattern;
PenBox.Canvas.Line(120, y, PenBox.Width - 10, y);
var
i, j: integer;
ColWidth, RowHeight: Integer;
R: TRect;
begin
PaintBox.Canvas.Brush.Color := BrushColorBox.Selected;
ColWidth := PaintBox.Width div 3;
RowHeight := PaintBox.Height div 2;
for i := 0 to 2 do
for j := 0 to 2 do
begin
R := Rect(i * ColWidth, j * RowHeight, (i + 1) * ColWidth, (j + 1) * RowHeight);
DrawFigure(R);
end;
end;
procedure TForm1.PenChange;
procedure TForm1.PenChange(Sender: TObject);
var
Dashes: array[0..3] of DWord = (1, 1, 1, 1);
begin
PenBox.Canvas.Pen.Color := PenColorBox.Selected;
PenBox.Canvas.Pen.Width := StrToInt(WidthCombo.Text);
PenBox.Canvas.Pen.Geometric := GeometricCheck.Checked;
PenBox.Canvas.Pen.EndCap := TPenEndCap(CapsCombo.ItemIndex);
PenBox.Canvas.Pen.JoinStyle := TPenJoinStyle(JoinCombo.ItemIndex);
PenBox.Canvas.Pen.SetPattern(Dashes);
PenBox.Invalidate;
end;
procedure TForm1.WidthComboChange(Sender: TObject);
begin
PenChange;
if PenStyleCombo.ItemIndex <> -1 then
PaintBox.Canvas.Pen.Style := TPenStyle(PenStyleCombo.ItemIndex);
PaintBox.Canvas.Pen.Color := PenColorBox.Selected;
PaintBox.Canvas.Pen.Width := StrToInt(WidthCombo.Text);
PaintBox.Canvas.Pen.Geometric := GeometricCheck.Checked;
PaintBox.Canvas.Pen.EndCap := TPenEndCap(CapsCombo.ItemIndex);
PaintBox.Canvas.Pen.JoinStyle := TPenJoinStyle(JoinCombo.ItemIndex);
PaintBox.Canvas.Pen.SetPattern(Dashes);
PaintBox.Invalidate;
end;
initialization