lcl: remove TPen.Geometric property and add TPen.Cosmetic. TPen.Cosmetic is a read only property. It setups when TPen.Width is changed

examples: change Pen and Brush example

git-svn-id: trunk@17360 -
This commit is contained in:
paul 2008-11-13 01:37:19 +00:00
parent 2d1f0ad35d
commit 4e63b11c8e
5 changed files with 102 additions and 89 deletions

View File

@ -218,6 +218,7 @@ object Form1: TForm1
'6' '6'
'7' '7'
) )
MaxLength = -1
OnChange = PenChange OnChange = PenChange
Style = csDropDownList Style = csDropDownList
TabOrder = 1 TabOrder = 1
@ -240,6 +241,7 @@ object Form1: TForm1
'Square' 'Square'
'Flat' 'Flat'
) )
MaxLength = -1
OnChange = PenChange OnChange = PenChange
Style = csDropDownList Style = csDropDownList
TabOrder = 2 TabOrder = 2
@ -262,26 +264,12 @@ object Form1: TForm1
'Bevel' 'Bevel'
'Mitter' 'Mitter'
) )
MaxLength = -1
OnChange = PenChange OnChange = PenChange
Style = csDropDownList Style = csDropDownList
TabOrder = 3 TabOrder = 3
Text = 'Round' Text = 'Round'
end end
object GeometricCheck: TCheckBox
AnchorSideLeft.Control = WidthCombo
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = WidthCombo
AnchorSideTop.Side = asrCenter
Left = 217
Height = 19
Top = 261
Width = 74
BorderSpacing.Left = 7
Caption = 'Geometric'
OnChange = PenChange
ParentBidiMode = False
TabOrder = 4
end
object PenColorBox: TColorBox object PenColorBox: TColorBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = WidthCombo AnchorSideTop.Control = WidthCombo
@ -295,7 +283,7 @@ object Form1: TForm1
BorderSpacing.Top = 7 BorderSpacing.Top = 7
ItemHeight = 16 ItemHeight = 16
OnChange = PenChange OnChange = PenChange
TabOrder = 5 TabOrder = 4
end end
object PenStyleCombo: TComboBox object PenStyleCombo: TComboBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -308,9 +296,10 @@ object Form1: TForm1
BorderSpacing.Left = 100 BorderSpacing.Left = 100
BorderSpacing.Top = 7 BorderSpacing.Top = 7
ItemHeight = 13 ItemHeight = 13
MaxLength = -1
OnChange = PenChange OnChange = PenChange
Style = csDropDownList Style = csDropDownList
TabOrder = 6 TabOrder = 5
end end
object BrushStyleCombo: TComboBox object BrushStyleCombo: TComboBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -323,10 +312,9 @@ object Form1: TForm1
BorderSpacing.Left = 100 BorderSpacing.Left = 100
BorderSpacing.Top = 7 BorderSpacing.Top = 7
ItemHeight = 13 ItemHeight = 13
MaxLength = -1
OnChange = BrushChange OnChange = BrushChange
Style = csDropDownList Style = csDropDownList
TabOrder = 7 TabOrder = 6
end end
object BrushColorBox: TColorBox object BrushColorBox: TColorBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -342,7 +330,7 @@ object Form1: TForm1
BorderSpacing.Top = 7 BorderSpacing.Top = 7
ItemHeight = 16 ItemHeight = 16
OnChange = BrushChange OnChange = BrushChange
TabOrder = 8 TabOrder = 7
end end
object FigureCombo: TComboBox object FigureCombo: TComboBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -363,9 +351,26 @@ object Form1: TForm1
'Rectangle' 'Rectangle'
'Triangle' 'Triangle'
) )
MaxLength = -1
OnChange = FigureComboChange OnChange = FigureComboChange
Style = csDropDownList Style = csDropDownList
TabOrder = 9 TabOrder = 8
Text = 'Line' Text = 'Line'
end end
object cbCosmetic: TCheckBox
AnchorSideLeft.Control = WidthCombo
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = WidthCombo
AnchorSideTop.Side = asrCenter
Left = 217
Height = 19
Top = 261
Width = 69
BorderSpacing.Left = 7
Caption = 'Cosmetic'
Checked = True
OnChange = PenChange
State = cbChecked
TabOrder = 9
end
end end

View File

@ -69,51 +69,53 @@ LazarusResources.Add('TForm1','FORMDATA',[
+'eTop.Control'#7#13'PenStyleCombo'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'L' +'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 +'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.' +'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 +'Strings'#1#6#1'1'#6#1'2'#6#1'3'#6#1'4'#6#1'5'#6#1'6'#6#1'7'#0#9'MaxLength'#2
+#9'PenChange'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1#4'Text'#6#1'1'#0 +#255#8'OnChange'#7#9'PenChange'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1
+#0#9'TComboBox'#9'CapsCombo'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anchor' +#4'Text'#6#1'1'#0#0#9'TComboBox'#9'CapsCombo'#22'AnchorSideLeft.Control'#7#5
+'SideTop.Control'#7#11'PenColorBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4 +'Owner'#21'AnchorSideTop.Control'#7#11'PenColorBox'#18'AnchorSideTop.Side'#7
+'Left'#2'd'#6'Height'#2#21#3'Top'#3'='#1#5'Width'#2'n'#18'BorderSpacing.Left' +#9'asrBottom'#4'Left'#2'd'#6'Height'#2#21#3'Top'#3'='#1#5'Width'#2'n'#18'Bor'
+#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#13#9'ItemIndex'#2#0#13'Item' +'derSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#13#9'ItemI'
+'s.Strings'#1#6#5'Round'#6#6'Square'#6#4'Flat'#0#8'OnChange'#7#9'PenChange'#5 +'ndex'#2#0#13'Items.Strings'#1#6#5'Round'#6#6'Square'#6#4'Flat'#0#9'MaxLengt'
+'Style'#7#14'csDropDownList'#8'TabOrder'#2#2#4'Text'#6#5'Round'#0#0#9'TCombo' +'h'#2#255#8'OnChange'#7#9'PenChange'#5'Style'#7#14'csDropDownList'#8'TabOrde'
+'Box'#9'JoinCombo'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Co' +'r'#2#2#4'Text'#6#5'Round'#0#0#9'TComboBox'#9'JoinCombo'#22'AnchorSideLeft.C'
+'ntrol'#7#9'CapsCombo'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'd'#6 +'ontrol'#7#5'Owner'#21'AnchorSideTop.Control'#7#9'CapsCombo'#18'AnchorSideTo'
+'Height'#2#21#3'Top'#3'Y'#1#5'Width'#2'n'#18'BorderSpacing.Left'#2'd'#17'Bor' +'p.Side'#7#9'asrBottom'#4'Left'#2'd'#6'Height'#2#21#3'Top'#3'Y'#1#5'Width'#2
+'derSpacing.Top'#2#7#10'ItemHeight'#2#13#9'ItemIndex'#2#0#13'Items.Strings'#1 +'n'#18'BorderSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#13
+#6#5'Round'#6#5'Bevel'#6#6'Mitter'#0#8'OnChange'#7#9'PenChange'#5'Style'#7#14 +#9'ItemIndex'#2#0#13'Items.Strings'#1#6#5'Round'#6#5'Bevel'#6#6'Mitter'#0#9
+'csDropDownList'#8'TabOrder'#2#3#4'Text'#6#5'Round'#0#0#9'TCheckBox'#14'Geom' +'MaxLength'#2#255#8'OnChange'#7#9'PenChange'#5'Style'#7#14'csDropDownList'#8
+'etricCheck'#22'AnchorSideLeft.Control'#7#10'WidthCombo'#19'AnchorSideLeft.S' +'TabOrder'#2#3#4'Text'#6#5'Round'#0#0#9'TColorBox'#11'PenColorBox'#22'Anchor'
+'ide'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#10'WidthCombo'#18'AnchorSid' +'SideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#10'WidthCombo'#18
+'eTop.Side'#7#9'asrCenter'#4'Left'#3#217#0#6'Height'#2#19#3'Top'#3#5#1#5'Wid' +'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'd'#6'Height'#2#22#3'Top'#3' '#1
+'th'#2'J'#18'BorderSpacing.Left'#2#7#7'Caption'#6#9'Geometric'#8'OnChange'#7 +#5'Width'#2'n'#5'Style'#11#16'cbStandardColors'#16'cbExtendedColors'#14'cbSy'
+#9'PenChange'#14'ParentBidiMode'#8#8'TabOrder'#2#4#0#0#9'TColorBox'#11'PenCo' +'stemColors'#13'cbCustomColor'#13'cbPrettyNames'#0#18'BorderSpacing.Left'#2
+'lorBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#10 +'d'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#16#8'OnChange'#7#9'PenChange'
+'WidthCombo'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'd'#6'Height'#2 +#8'TabOrder'#2#4#0#0#9'TComboBox'#13'PenStyleCombo'#22'AnchorSideLeft.Contro'
+#22#3'Top'#3' '#1#5'Width'#2'n'#5'Style'#11#16'cbStandardColors'#16'cbExtend' +'l'#7#5'Owner'#21'AnchorSideTop.Control'#7#6'Label1'#18'AnchorSideTop.Side'#7
+'edColors'#14'cbSystemColors'#13'cbCustomColor'#13'cbPrettyNames'#0#18'Borde' +#9'asrBottom'#4'Left'#2'd'#6'Height'#2#21#3'Top'#3#232#0#5'Width'#2'n'#18'Bo'
+'rSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#16#8'OnChang' +'rderSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#13#9'MaxL'
+'e'#7#9'PenChange'#8'TabOrder'#2#5#0#0#9'TComboBox'#13'PenStyleCombo'#22'Anc' +'ength'#2#255#8'OnChange'#7#9'PenChange'#5'Style'#7#14'csDropDownList'#8'Tab'
+'horSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#6'Label1'#18'An' +'Order'#2#5#0#0#9'TComboBox'#15'BrushStyleCombo'#22'AnchorSideLeft.Control'#7
+'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' +#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' +'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' +'rSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#13#8'OnChang'
+'th'#2#255#8'OnChange'#7#11'BrushChange'#5'Style'#7#14'csDropDownList'#8'Tab' +'e'#7#11'BrushChange'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#6#0#0#9'TC'
+'Order'#2#7#0#0#9'TColorBox'#13'BrushColorBox'#22'AnchorSideLeft.Control'#7#5 +'olorBox'#13'BrushColorBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorS'
+'Owner'#21'AnchorSideTop.Control'#7#15'BrushStyleCombo'#18'AnchorSideTop.Sid' +'ideTop.Control'#7#15'BrushStyleCombo'#18'AnchorSideTop.Side'#7#9'asrBottom'
+'e'#7#9'asrBottom'#4'Left'#2'd'#6'Height'#2#22#3'Top'#3#166#1#5'Width'#2'n'#8 +#4'Left'#2'd'#6'Height'#2#22#3'Top'#3#166#1#5'Width'#2'n'#8'Selected'#7#9'cl'
+'Selected'#7#9'clBtnFace'#5'Style'#11#16'cbStandardColors'#16'cbExtendedColo' +'BtnFace'#5'Style'#11#16'cbStandardColors'#16'cbExtendedColors'#14'cbSystemC'
+'rs'#14'cbSystemColors'#13'cbCustomColor'#13'cbPrettyNames'#0#18'BorderSpaci' +'olors'#13'cbCustomColor'#13'cbPrettyNames'#0#18'BorderSpacing.Left'#2'd'#17
+'ng.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#16#8'OnChange'#7#11 +'BorderSpacing.Top'#2#7#10'ItemHeight'#2#16#8'OnChange'#7#11'BrushChange'#8
+'BrushChange'#8'TabOrder'#2#8#0#0#9'TComboBox'#11'FigureCombo'#22'AnchorSide' +'TabOrder'#2#7#0#0#9'TComboBox'#11'FigureCombo'#22'AnchorSideLeft.Control'#7
+'Left.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#8'PaintBox'#18'AnchorS' +#5'Owner'#21'AnchorSideTop.Control'#7#8'PaintBox'#18'AnchorSideTop.Side'#7#9
+'ideTop.Side'#7#9'asrBottom'#4'Left'#2'd'#6'Height'#2#21#3'Top'#3#183#0#5'Wi' +'asrBottom'#4'Left'#2'd'#6'Height'#2#21#3'Top'#3#183#0#5'Width'#2'n'#18'Bord'
+'dth'#2'n'#18'BorderSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeig' +'erSpacing.Left'#2'd'#17'BorderSpacing.Top'#2#7#10'ItemHeight'#2#13#9'ItemIn'
+'ht'#2#13#9'ItemIndex'#2#0#13'Items.Strings'#1#6#4'Line'#6#8'PolyLine'#6#7'E' +'dex'#2#0#13'Items.Strings'#1#6#4'Line'#6#8'PolyLine'#6#7'Ellipse'#6#9'Recta'
+'llipse'#6#9'Rectangle'#6#8'Triangle'#0#8'OnChange'#7#17'FigureComboChange'#5 +'ngle'#6#8'Triangle'#0#9'MaxLength'#2#255#8'OnChange'#7#17'FigureComboChange'
+'Style'#7#14'csDropDownList'#8'TabOrder'#2#9#4'Text'#6#4'Line'#0#0#0 +#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#8#4'Text'#6#4'Line'#0#0#9'TChec'
+'kBox'#10'cbCosmetic'#22'AnchorSideLeft.Control'#7#10'WidthCombo'#19'AnchorS'
+'ideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#10'WidthCombo'#18
+'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#3#217#0#6'Height'#2#19#3'Top'#3#5
+#1#5'Width'#2'E'#18'BorderSpacing.Left'#2#7#7'Caption'#6#8'Cosmetic'#7'Check'
+'ed'#9#8'OnChange'#7#9'PenChange'#5'State'#7#9'cbChecked'#8'TabOrder'#2#9#0#0
+#0
]); ]);

View File

@ -16,6 +16,7 @@ type
Bevel1: TBevel; Bevel1: TBevel;
Bevel2: TBevel; Bevel2: TBevel;
Button1: TBitBtn; Button1: TBitBtn;
cbCosmetic: TCheckBox;
FigureCombo: TComboBox; FigureCombo: TComboBox;
Label10: TLabel; Label10: TLabel;
Label7: TLabel; Label7: TLabel;
@ -26,7 +27,6 @@ type
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
PenColorBox: TColorBox; PenColorBox: TColorBox;
GeometricCheck: TCheckBox;
Label6: TLabel; Label6: TLabel;
BrushStyleCombo: TComboBox; BrushStyleCombo: TComboBox;
WidthCombo: TComboBox; WidthCombo: TComboBox;
@ -176,11 +176,17 @@ procedure TForm1.PenChange(Sender: TObject);
var var
Dashes: array[0..3] of DWord = (1, 1, 1, 1); Dashes: array[0..3] of DWord = (1, 1, 1, 1);
begin begin
cbCosmetic.Enabled := WidthCombo.ItemIndex = 0;
if PenStyleCombo.ItemIndex <> -1 then if PenStyleCombo.ItemIndex <> -1 then
PaintBox.Canvas.Pen.Style := TPenStyle(PenStyleCombo.ItemIndex); PaintBox.Canvas.Pen.Style := TPenStyle(PenStyleCombo.ItemIndex);
PaintBox.Canvas.Pen.Color := PenColorBox.Selected; PaintBox.Canvas.Pen.Color := PenColorBox.Selected;
PaintBox.Canvas.Pen.Width := StrToInt(WidthCombo.Text);
PaintBox.Canvas.Pen.Geometric := GeometricCheck.Checked; if cbCosmetic.Enabled and cbCosmetic.Checked then
PaintBox.Canvas.Pen.Width := 0
else
PaintBox.Canvas.Pen.Width := StrToInt(WidthCombo.Text);
PaintBox.Canvas.Pen.EndCap := TPenEndCap(CapsCombo.ItemIndex); PaintBox.Canvas.Pen.EndCap := TPenEndCap(CapsCombo.ItemIndex);
PaintBox.Canvas.Pen.JoinStyle := TPenJoinStyle(JoinCombo.ItemIndex); PaintBox.Canvas.Pen.JoinStyle := TPenJoinStyle(JoinCombo.ItemIndex);
PaintBox.Canvas.Pen.SetPattern(Dashes); PaintBox.Canvas.Pen.SetPattern(Dashes);

View File

@ -586,7 +586,7 @@ type
private private
FColor: TColor; FColor: TColor;
FEndCap: TPenEndCap; FEndCap: TPenEndCap;
FGeometric: Boolean; FCosmetic: Boolean;
FJoinStyle: TPenJoinStyle; FJoinStyle: TPenJoinStyle;
FPattern: TPenPattern; FPattern: TPenPattern;
FPenHandleCached: boolean; FPenHandleCached: boolean;
@ -604,7 +604,6 @@ type
procedure SetFPColor(const AValue: TFPColor); override; procedure SetFPColor(const AValue: TFPColor); override;
procedure SetColor(Value: TColor); procedure SetColor(Value: TColor);
procedure SetEndCap(const AValue: TPenEndCap); procedure SetEndCap(const AValue: TPenEndCap);
procedure SetGeometric(const AValue: Boolean);
procedure SetJoinStyle(const AValue: TPenJoinStyle); procedure SetJoinStyle(const AValue: TPenJoinStyle);
procedure SetMode(Value: TPenMode); override; procedure SetMode(Value: TPenMode); override;
procedure SetStyle(Value: TPenStyle); override; procedure SetStyle(Value: TPenStyle); override;
@ -620,7 +619,7 @@ type
procedure SetPattern(APattern: TPenPattern); reintroduce; procedure SetPattern(APattern: TPenPattern); reintroduce;
published published
property Color: TColor read FColor write SetColor default clBlack; property Color: TColor read FColor write SetColor default clBlack;
property Geometric: Boolean read FGeometric write SetGeometric default False; property Cosmetic: Boolean read FCosmetic;
property EndCap: TPenEndCap read FEndCap write SetEndCap default pecRound; property EndCap: TPenEndCap read FEndCap write SetEndCap default pecRound;
property JoinStyle: TPenJoinStyle read FJoinStyle write SetJoinStyle default pjsRound; property JoinStyle: TPenJoinStyle read FJoinStyle write SetJoinStyle default pjsRound;
property Mode default pmCopy; property Mode default pmCopy;

View File

@ -193,9 +193,16 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TPen.SetWidth(Value : Integer); procedure TPen.SetWidth(Value : Integer);
begin begin
if Width <> Value then // Cosmetic pen is a pen which has width = 0. FCL does not allow pens < 1.
// FCosmetic field contains a knowledge about passed value
if (Value = 0) and (Width = 1) and Cosmetic then
Exit;
if (Width <> Value) or ((Width = 1) and Cosmetic) then
begin begin
FreeReference; FreeReference;
FCosmetic := Value = 0;
inherited SetWidth(Value); inherited SetWidth(Value);
Changed; Changed;
end; end;
@ -214,7 +221,7 @@ begin
DelayAllocate := True; DelayAllocate := True;
FEndCap := pecRound; FEndCap := pecRound;
FJoinStyle := pjsRound; FJoinStyle := pjsRound;
FGeometric := False; FCosmetic := True;
FPattern := nil; FPattern := nil;
inherited SetWidth(1); inherited SetWidth(1);
inherited SetStyle(psSolid); inherited SetStyle(psSolid);
@ -249,11 +256,15 @@ var
begin begin
if Source is TPen then if Source is TPen then
begin begin
Width := APen.Width;
if APen.Cosmetic then
Width := 0
else
Width := APen.Width;
SetColor(APen.Color, TFPCanvasHelper(Source).FPColor); SetColor(APen.Color, TFPCanvasHelper(Source).FPColor);
Style := APen.Style; Style := APen.Style;
Mode := APen.Mode; Mode := APen.Mode;
Geometric := APen.Geometric;
JoinStyle := APen.JoinStyle; JoinStyle := APen.JoinStyle;
EndCap := APen.EndCap; EndCap := APen.EndCap;
end end
@ -372,8 +383,8 @@ begin
FillChar(AExtPen, SizeOf(AExtPen), 0); FillChar(AExtPen, SizeOf(AExtPen), 0);
with AExtPen do with AExtPen do
begin begin
elpPenStyle := PEN_STYLES[Style] or PEN_GEOMETRIC[Geometric]; elpPenStyle := PEN_STYLES[Style] or PEN_GEOMETRIC[not Cosmetic];
if Geometric then if not Cosmetic then
elpPenStyle := elpPenStyle or PEN_ENDCAP[EndCap] or PEN_JOIN[JoinStyle]; elpPenStyle := elpPenStyle or PEN_ENDCAP[EndCap] or PEN_JOIN[JoinStyle];
elpWidth := Width; elpWidth := Width;
elpBrushStyle := BS_SOLID; elpBrushStyle := BS_SOLID;
@ -433,16 +444,6 @@ begin
end; end;
end; end;
procedure TPen.SetGeometric(const AValue: Boolean);
begin
if Geometric <> AValue then
begin
FreeReference;
FGeometric := AValue;
Changed;
end;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TPen.FreeReference Method: TPen.FreeReference
Params: none Params: none
@ -485,7 +486,7 @@ begin
begin begin
FreeReference; FreeReference;
inherited DoCopyProps(From); inherited DoCopyProps(From);
FGeometric := APen.Geometric; FCosmetic := APen.Cosmetic;
FEndCap := APen.EndCap; FEndCap := APen.EndCap;
FJoinStyle := APen.JoinStyle; FJoinStyle := APen.JoinStyle;
//TODO: query new parameters //TODO: query new parameters