Is there a function or procedure that gives the Width of a component?
I'd like to be able to find out (in inches) the width of a particulat
caption
I'm using:
ppReport.Printer.Canvas.Font.Size := iPointSize;
this_liTextWidth := ppReport.Printer.Canvas.TextWidth(ppLabel.Caption);
this_liTextWidth := ppToMMThousandths(this_liTextWidth,
utPrinterPixels,pprtHorizontal, ppReport.Printer);
liDPI := ppLabel.Font.PixelsPerInch;
Result := ((this_liTextWidth / liDPI) / InchPerMM);
The result is far from close.
Thanks
caption
I'm using:
ppReport.Printer.Canvas.Font.Size := iPointSize;
this_liTextWidth := ppReport.Printer.Canvas.TextWidth(ppLabel.Caption);
this_liTextWidth := ppToMMThousandths(this_liTextWidth,
utPrinterPixels,pprtHorizontal, ppReport.Printer);
liDPI := ppLabel.Font.PixelsPerInch;
Result := ((this_liTextWidth / liDPI) / InchPerMM);
The result is far from close.
Thanks
This discussion has been closed.
Comments
this_ppLabel :=
TppLabel.Create(ppDetailBand);
this_ppLabel.CharWrap := False;
this_ppLabel.WordWrap := False;
this_ppLabel.Font := ppLabel.font;
this_ppLabel.Width := 0;
this_ppLabel.Autosize := True;
this_ppLabel.Caption := ppLabel.Caption;
this_dWidth := this_ppLabel.Width;
this_ppLabel.Destroy;
Result := this_dWidth;
The ppToMMThousandths class function will give you the width of the label
text in thousandths of a millimeter or microns. You can then convert to
inches by using the constant .00003937 inches per micron (or 25400 microns
per inch). So to get inches, you would do something like the following...
Result := this_liTextWidth * (InchPerMM / 1000);
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com