TAChart: Extract PrepareSimplePen utility procedure

git-svn-id: trunk@25062 -
This commit is contained in:
ask 2010-04-29 06:19:37 +00:00
parent 3560ac7c3f
commit 78eb50a8d5
4 changed files with 13 additions and 11 deletions

View File

@ -366,12 +366,8 @@ var
procedure DrawLabelAndTick(const ALabelRect, ATickRect: TRect; const AText: String);
begin
if Marks.IsLabelHiddenDueToOverlap(prevLabelRect, ALabelRect) then exit;
ACanvas.Pen.Color := TickColor;
ACanvas.Pen.Style := psSolid;
ACanvas.Pen.Mode := pmCopy;
PrepareSimplePen(ACanvas, TickColor);
ACanvas.Line(ATickRect);
Marks.DrawLabel(ACanvas, ALabelRect, AText);
end;

View File

@ -215,6 +215,7 @@ function PointDist(const A, B: TPoint): Integer; inline;
function PointDistX(const A, B: TPoint): Integer; inline;
function PointDistY(const A, B: TPoint): Integer; inline;
procedure PrepareSimplePen(ACanvas: TCanvas; AColor: TColor);
procedure PrepareXorPen(ACanvas: TCanvas);
function RectIntersectsRect(
@ -494,6 +495,16 @@ begin
Result := Abs(A.Y - B.Y);
end;
procedure PrepareSimplePen(ACanvas: TCanvas; AColor: TColor);
begin
with ACanvas.Pen do begin
Color := AColor;
Style := psSolid;
Mode := pmCopy;
Width := 1;
end;
end;
procedure PrepareXorPen(ACanvas: TCanvas);
begin
with ACanvas do begin

View File

@ -553,9 +553,7 @@ end;
procedure TChart.Clean(ACanvas: TCanvas; ARect: TRect);
begin
ACanvas.Pen.Mode := pmCopy;
ACanvas.Pen.Style := psSolid;
ACanvas.Pen.Color := Color;
PrepareSimplePen(ACanvas, Color);
ACanvas.Brush.Color := Color;
ACanvas.Brush.Style := bsSolid;
ACanvas.Rectangle(ARect);

View File

@ -690,9 +690,6 @@ begin
FBarPen := TPen.Create;
FBarPen.OnChange := @StyleChanged;
FBarPen.Mode := pmCopy;
FBarPen.Style := psSolid;
FBarPen.Width := 1;
FBarPen.Color := clBlack;
FBarBrush.Color := clRed;
end;