TAChart: Synchronize extents of standard and BGRA view

git-svn-id: trunk@30200 -
This commit is contained in:
ask 2011-04-05 17:16:16 +00:00
parent eda3f30176
commit 178ea522e7
2 changed files with 10 additions and 0 deletions

View File

@ -32,6 +32,7 @@ object Form1: TForm1
'Standard'
)
Title.Visible = True
OnAfterPaint = Chart1AfterPaint
Align = alLeft
Color = clGreen
ParentColor = False

View File

@ -19,6 +19,7 @@ type
PaintBox1: TPaintBox;
RandomChartSource1: TRandomChartSource;
Splitter1: TSplitter;
procedure Chart1AfterPaint(ASender: TChart);
procedure PaintBox1Paint(Sender: TObject);
end;
@ -34,10 +35,16 @@ uses
{ TForm1 }
procedure TForm1.Chart1AfterPaint(ASender: TChart);
begin
PaintBox1.Invalidate;
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
var
bmp: TBGRABitmap;
id: IChartDrawer;
rp: TChartRenderingParams;
begin
bmp := TBGRABitmap.Create(PaintBox1.Width, PaintBox1.Height);
Chart1.DisableRedrawing;
@ -45,7 +52,9 @@ begin
Chart1.Title.Text.Text := 'BGRABitmap';
id := TBGRABitmapDrawer.Create(bmp);
id.DoGetFontOrientation := @CanvasGetFontOrientationFunc;
rp := Chart1.RenderingParams;
Chart1.Draw(id, Rect(0, 0, PaintBox1.Width, PaintBox1.Height));
Chart1.RenderingParams := rp;
bmp.Draw(PaintBox1.Canvas, 0, 0);
Chart1.Title.Text.Text := 'Standard';
finally