DBText Font
I was wondering if the following is possible. Say there is a ppDBText
component with a Name that is 50 characters long. The font is set to
Arial , 8 pt. If for example the name gets longer than 50 characters,
is there a way to automatically set the font to 7pt for example.
I assume this is not possible on the component, so would this just have
to be done on the Calc Tab?
component with a Name that is 50 characters long. The font is set to
Arial , 8 pt. If for example the name gets longer than 50 characters,
is there a way to automatically set the font to 7pt for example.
I assume this is not possible on the component, so would this just have
to be done on the Calc Tab?
This discussion has been closed.
Comments
There is not automatic way to shrink a font to fit in a give space. You
could do this manually by measuring the text before it is printed to be
sure it fits in the allotted space.
The TCanvas.TextWidth routine to measure the text. This may require a
RAP passthru function.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
component.
In RAP it will be look something like this:
procedure ppDBTextOnDrawCommandCreate(aDrawCommand: TObject);
var
DrawText: TppDrawText;
begin
DrawText := aDrawCommand as TppDrawCommand;
if Length(DrawText.Text) > 50 then
DrawText.Font.Size := 7;
end;