Version

CalcIdealSize() Method

Calculates the size required to fully display the contents.
Syntax
'Declaration
 
Public Overloads Function CalcIdealSize() As Size
public Size CalcIdealSize()

Return Value

the size required to fully display the contents.
Example
The following code uses CalcIdealSize method to calculate the size necessary to fully display the contents.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Misc
Imports Infragistics.Win.FormattedLinkLabel

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        Me.UltraFormattedLinkLabel1.Value = "<b>Bold</b>, <i>Italic</i>, <u>Underline</u>"

        ' CalcIdealSize calculates the size required to fully display the contents.
        Dim size As Size = Me.UltraFormattedLinkLabel1.CalcIdealSize()
        Debug.WriteLine("Size required to fully show contents: " & size.ToString())

        ' You can use the overload that takes in proposed size to calculate the 
        ' height required based on the width of the specified size parameter.
        ' Note that the width of the returned size can be larger than the width
        ' of the proposed size in case a single word is bigger than the proposed
        ' width since words aren't wrapped from the middle.
        size = Me.UltraFormattedLinkLabel1.CalcIdealSize(New Size(40, 0))
        Debug.WriteLine("Height required to fully show contents when width is 40: " & size.ToString())
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Misc;
using Infragistics.Win.FormattedLinkLabel;
using System.Diagnostics;


		private void button1_Click(object sender, System.EventArgs e)
		{
			this.ultraFormattedLinkLabel1.Value = "<b>Bold</b>, <i>Italic</i>, <u>Underline</u>";

			// CalcIdealSize calculates the size required to fully display the contents.
			Size size = this.ultraFormattedLinkLabel1.CalcIdealSize( );
			Debug.WriteLine( "Size required to fully show contents: " + size.ToString( ) );

			// You can use the overload that takes in proposed size to calculate the 
			// height required based on the width of the specified size parameter.
			// Note that the width of the returned size can be larger than the width
			// of the proposed size in case a single word is bigger than the proposed
			// width since words aren't wrapped from the middle.
			size = this.ultraFormattedLinkLabel1.CalcIdealSize( new Size( 40, 0 ) );
			Debug.WriteLine( "Height required to fully show contents when width is 40: " + size.ToString( ) );
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, 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