System.Windows.Forms.Label.PreferredHeight Property

Gets the preferred height of the control.

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.Browsable(false)]
public virtual int PreferredHeight { get; }

Value

Documentation for this section has not yet been entered.

Remarks

This property returns the height that the control should be in order to properly display text, based on the font assigned to the control. You can use this property along with the Label.PreferredWidth property to ensure that the text in the System.Windows.Forms.Label control is displayed properly. You can use the Label.AutoSize property to automatically adjust the height and the width of the System.Windows.Forms.Label control, based on the text and font size.

Note:

If the Label.BorderStyle property of the System.Windows.Forms.Label control is set to BorderStyle.None, the value returned by Label.PreferredHeight property will be larger due to the lack of borders.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0