ActiveReports 14 .NET Edition
GrapeCity.ActiveReports.Document Assembly / GrapeCity.ActiveReports.Document.Section Namespace / Page Class / MeasureParagraphHeight Method
Example

In This Topic
    MeasureParagraphHeight Method
    In This Topic
    Measures the height of the specified text if rendered using the current page settings with the specified width.
    Overload List
    OverloadDescription
    Measures the height of the specified text in a specified width at run time.  
    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
    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;
    }
    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
    See Also