This is a migrated thread and some comments may be shown as answers.

Calculate Size of a TextBox

3 Answers 247 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Edward Pauley
Top achievements
Rank 1
Edward Pauley asked on 25 Apr 2011, 11:53 PM

I need to create a report programicly.  if i have a text box and that will be filled with the Text "foobar" at Arial 10 bold.  how do i calculate the length.  Below is what i need to achieve.   is there a way to calculate the length to place in the code below without guessing..  

 

 

new

 

 

Telerik.Reporting.Drawing.Unit(0.800000011920929D, Telerik.Reporting.Drawing.UnitType.Inch)

 

3 Answers, 1 is accepted

Sort by
0
Squall
Top achievements
Rank 1
answered on 27 Apr 2011, 01:25 PM
Hi,
font measuring is not simple task and requires usage of Graphics.MeasureString().
SN
0
stefano
Top achievements
Rank 1
answered on 30 May 2011, 03:41 PM
I also need to calculate the size required to render a textbox. I know how to use Graphices.MeasureString, however I don't understand where this method can be called. Where can i get an instance of the Graphics class?

Best regards
Stefano Isella
0
Squall
Top achievements
Rank 1
answered on 31 May 2011, 05:09 PM
You should create and maintain your own instance. I am not aware of Graphics instance that is available in reports.
SN
Tags
General Discussions
Asked by
Edward Pauley
Top achievements
Rank 1
Answers by
Squall
Top achievements
Rank 1
stefano
Top achievements
Rank 1
Share this question
or