Page 1 of 1
Adjusting line height of TRectagleTool
Posted: Wed Sep 02, 2015 3:36 pm
by 16570767
Hi there.
Please have a look at the following image:
- Form2_2015-09-02_17-30-11.png (40.42 KiB) Viewed 9991 times
On the left you see a normal TMemo straight from the VCL.
On the right, we have a TeeChart with a TRectangleTool on it. By themselves, they both look fine.
However, I am puzzled about the different line height of the TRectangleTool. There is more space between the lines. Is there a way to adjust the "line spacing"? I have found no way.
Many thanks in advance.
Re: Adjusting line height of TRectagleTool
Posted: Fri Sep 04, 2015 12:53 pm
by yeray
Hello,
Can you please attach here that simple test project?
Re: Adjusting line height of TRectagleTool
Posted: Fri Sep 04, 2015 3:49 pm
by 16570767
Sure. There's not much magic involved:
Code: Select all
procedure TForm3.createTool();
begin
textRectangle := TRectangleTool.Create(Chart);
textRectangle.ParentChart := Chart;
textRectangle.Shape.Font.Assign(Font);
textRectangle.Shape.Font.Color := TColors.Black; // I have no clue why this is necessary
textRectangle.Text := Memo1.Lines.Text;
textRectangle.Bounds := textRectangle.ParentChart.ClientRect;
textRectangle.Shape.Transparency := 0;
Chart.Tools.Add(textRectangle);
end;
Re: Adjusting line height of TRectagleTool
Posted: Mon Sep 07, 2015 10:49 am
by yeray
Hello,
Thanks for sharing the test project.
This is because TeeChart uses GDIPlus by default since a few releases ago and different techniques are used to calculate the TextHeight.
Adding this to your test project gives a more similar result at both sides:
Code: Select all
type
TCanvasAccess=class(TTeeCanvas3D);
//...
Chart.Canvas:=TTeeCanvas3D.Create;
TCanvasAccess(Chart.Canvas).FontQuality:=fqClearType;
Re: Adjusting line height of TRectagleTool
Posted: Mon Sep 07, 2015 10:56 am
by 16570767
Yes, they're almost identical now. Thank you.
It still has a pretty different ... padding compared to a TMemo but I think I can sort that out. Thanks again.