ActiveReports 8
MeasureParagraphHeight Method
See Also  Example
GrapeCity.ActiveReports.Document.v8 Assembly > GrapeCity.ActiveReports.Document.Section Namespace > Page Class : MeasureParagraphHeight Method

Glossary Item Box

Measures the height of the specified text if rendered using the current page settings with the specified width.

Overload List

OverloadDescription
MeasureParagraphHeight(String,Single)Measures the height of the specified text in a specified width at run time.  
MeasureParagraphHeight(String,Single,Font,StringFormat)Measures the height of the specified text in a specified width, font, and format at run time.  

Remarks

Units are determined by the Page.Units property.

Example

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

    System.Drawing.SizeF x;
        
    rpt.CurrentPage.Font = this.TextBox1.Font;
    Console.WriteLine("TextBox1 Size = " + this.TextBox1.Size.ToString());
    string y;
    y = "This is a really long textbox with text that should wrap multiple lines so I can then measure the height of the text using the MeasureParagrahHeight method off of the page object.";
    x = arv.Document.Pages[0].MeasureParagraphHeight(y,this.TextBox1.Width);
    Console.WriteLine("MPH = " + x.ToString());
    this.TextBox1.Size = x.ToSize();
    this.TextBox1.Text = y;
}
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 x As System.Drawing.SizeF

    rpt.CurrentPage.Font = Me.TextBox1.Font
    Console.WriteLine("TextBox1 Size = " + Me.TextBox1.Size.ToString())
    Dim y As String
    y = "This is a really long textbox with text that should wrap multiple lines so I can then measure the height of the text using the MeasureParagrahHeight method off of the page object."
    x = arv.Document.Pages(0).MeasureParagraphHeight(y, Me.TextBox1.Width)
    Console.WriteLine("MPH = " + x.ToString())
    Me.TextBox1.Size = x.ToSize()
    Me.TextBox1.Text = y
End Sub

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also