How to resize font dynamically
Hi,
We have a customer that use pre-cut sticky labels. Is there any way to
have a 'printing region' such that if a printed field is too long then
the font size would automatically reduce in order to keep the text
within this region? (Hopefully I have made myself clear.)
What they want is to normally have the font at say size 12, but to
reduce it to 10 if it's going to over run the label width.
Thanks,
Dave
We have a customer that use pre-cut sticky labels. Is there any way to
have a 'printing region' such that if a printed field is too long then
the font size would automatically reduce in order to keep the text
within this region? (Hopefully I have made myself clear.)
What they want is to normally have the font at say size 12, but to
reduce it to 10 if it's going to over run the label width.
Thanks,
Dave
This discussion has been closed.
Comments
You should be able to check the available space and compare it to the space
taken inside the Band.BeforePrint event. Then inside a loop, begin
gradually shrinking the font size in order to fit the text. You will need
to use the Canvas.TextWidth and Canvas.TextHeight routines to pre-measure
the text before it is generated to the report. I assume the label size is
static. Take a look at the following demo for an example of how this can be
done.
http://www.digital-metaphors.com/tips/AutoFontSize.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Rgds,
Dave