ActiveReports.Viewer3 Request technical support
MeasureText Method
See Also  Example


strText
Text string to be measured.
Determines the width and height of text string.

Syntax

Visual Basic (Declaration) 
Public Function MeasureText( _
   ByVal strText As String _
) As SizeF
Visual Basic (Usage)Copy Code
Dim instance As Page
Dim strText As String
Dim value As SizeF
 
value = instance.MeasureText(strText)
C# 
public SizeF MeasureText( 
   string strText
)

Parameters

strText
Text string to be measured.

Return Value

SizeF structure that specifies the width and height of the string in inches.

Example

C#Copy Code
private void arv_Load(object sender, System.EventArgs e)
{
   rptDD rpt =
new rptDD();
   rpt.Run();
   arv.Document = rpt.Document;

   SizeF sz = arv.Document.Pages[0].MeasureText(
"This is my string. How long is it?");
   arv.Document.Pages[0].DrawText(
"This is my string. How long is it? " + sz.ToString(),0,0,6f,9f);
   arv.Document.Pages[0].DrawLine(0,sz.Height,sz.Width,sz.Height);
}
Visual BasicCopy Code
Private Sub arv_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles arv.Load
    Dim rpt As New rptDD
    rpt.Run()
    arv.Document = rpt.Document

    Dim sz As SizeF = arv.Document.Pages(0).MeasureText("This is my string. How long is it?")
    arv.Document.Pages(0).DrawText("This is my string. How long is it? " + sz.ToString(), 0, 0, 6.0F, 9.0F)
    arv.Document.Pages(0).DrawLine(0, sz.Height, sz.Width, sz.Height)
End Sub

See Also