Board index » delphi » pixel width of a string using a font

pixel width of a string using a font

Two questions:

1.  Does anyone know how to calculate the width in pixels of a string
using a specific font?

2.  Does anybody have any steps to paginate and print a TStringGrid to a
printer.  Pretty much like a spreadsheet.

Thanks in advance.

--
Luhit Young
Email: yo...@nettap.com
"It is better to keep your mouth shut and be considered a fool...
than to open it and remove all doubt!"

 

Re:pixel width of a string using a font


Quote
Luhit Young wrote:

> Two questions:

> 1.  Does anyone know how to calculate the width in pixels of a string
> using a specific font?

Canvas.TextWidth.

M.

--
Ettertraktet kaffe, er det ekstra god kaffe?

mailto:martin.lars...@delfi-data.msmail.telemax.no
http://www.delfidata.no/users/~martin

Re:pixel width of a string using a font


Quote
> 1.  Does anyone know how to calculate the width in pixels of a string
> using a specific font?

If you are using a canvas (such as painting on a component or the printer
object), use the TextWidth method.

Quote
> 2.  Does anybody have any steps to paginate and print a TStringGrid to a
> printer.  Pretty much like a spreadsheet.

I would just cycle through the Cells property, using Printer.TextOut.

--
Mark Pritchard
-------------
http://www.ozemail.com.au/~pritchma

Other Threads