Version

UltraLabel Class

Represents a standard windows label.
Syntax
'Declaration
 
Public Class UltraLabel 
   Inherits AutoSizeControlBase
   Implements Infragistics.Win.AppStyling.ISupportAppStyling, Infragistics.Win.IImageListProvider, Infragistics.Win.IUltraControl, Infragistics.Win.IUltraControlElement, Infragistics.Win.Touch.ISupportTouchMetrics, Infragistics.Win.UIAutomation.IProvideUIAutomation 
public class UltraLabel : AutoSizeControlBase, Infragistics.Win.AppStyling.ISupportAppStyling, Infragistics.Win.IImageListProvider, Infragistics.Win.IUltraControl, Infragistics.Win.IUltraControlElement, Infragistics.Win.Touch.ISupportTouchMetrics, Infragistics.Win.UIAutomation.IProvideUIAutomation  
Remarks

The UltraLabel control has functionality similar to that of the intrinsic .Net Label control as well as some additional functionality. There is an Appearance property that can be used to specify a gradient or hatched appearance as well as a HotTrackAppearance to more easily provide a different appearance when the mouse is over the control.

The BorderStyleInner and BorderStyleOuter can be used to create various border effects. The InnerBorderPadding controls the amount of space between the inner and outer borders.

Example
This sample demonstrates initializing some of the common properties of the UltraLabel control.

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

Private Sub InitializeLabel(ByVal label As Infragistics.Win.Misc.UltraLabel)

    ' specify a gradient for the label
    label.Appearance.BackColor = SystemColors.Control
    label.Appearance.BackColor2 = SystemColors.ControlDarkDark
    label.Appearance.BackGradientStyle = GradientStyle.ForwardDiagonal


    ' initialize the borders and allow for 3 pixels betwen the 
    ' inner and outer borders
    label.BorderStyleInner = UIElementBorderStyle.Etched
    label.BorderStyleOuter = UIElementBorderStyle.RaisedSoft
    label.InnerBorderPadding = New Size(3, 3)


    ' set the text and make it so that an ellipse
    ' is displayed if all the text cannot be displayed
    label.Text = "&This is a long line of text that would usually wrap."
    label.WrapText = False
    label.Appearance.TextTrimming = TextTrimming.EllipsisCharacter
    label.AutoSize = False


    ' the ampersand in the text should be treated as an access key
    label.UseMnemonic = True


    ' set the image to be displayed
    label.ImageList = Me.imageList1
    label.ImageSize = New Size(16, 16)
    label.Appearance.Image = 2 ' 3rd image in the imagelist
    label.ImageTransparentColor = Color.Silver


    ' add some padding between the borders and the image and text
    label.Padding = New Size(2, 2)


    ' change the appearance when the mouse is over the label
    label.HotTracking = True
    label.HotTrackAppearance.BackColor = SystemColors.ControlDark
    label.HotTrackAppearance.BackColor2 = SystemColors.ControlLight
End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Misc;

private void InitializeLabel(Infragistics.Win.Misc.UltraLabel label)
{
	// specify a gradient for the label
	label.Appearance.BackColor = SystemColors.Control;
	label.Appearance.BackColor2 = SystemColors.ControlDarkDark;
	label.Appearance.BackGradientStyle  = GradientStyle.ForwardDiagonal;


	// initialize the borders and allow for 3 pixels betwen the 
	// inner and outer borders
	label.BorderStyleInner = UIElementBorderStyle.Etched;
	label.BorderStyleOuter = UIElementBorderStyle.RaisedSoft;
	label.InnerBorderPadding = new Size(3,3);


	// set the text and make it so that an ellipse
	// is displayed if all the text cannot be displayed
	label.Text = "&This is a long line of text that would usually wrap.";
	label.WrapText = false;
	label.Appearance.TextTrimming = TextTrimming.EllipsisCharacter;
	label.AutoSize = false;


	// the ampersand in the text should be treated as an access key
	label.UseMnemonic = true;


	// set the image to be displayed
	label.ImageList = this.imageList1;
	label.ImageSize = new Size(16,16);
	label.Appearance.Image = 2;	// 3rd image in the imagelist
	label.ImageTransparentColor = Color.Silver;

	// add some padding between the borders and the image and text
	label.Padding = new Size(2,2);


	// change the appearance when the mouse is over the label
	label.HotTracking = true;
	label.HotTrackAppearance.BackColor = SystemColors.ControlDark;
	label.HotTrackAppearance.BackColor2 = SystemColors.ControlLight;
}
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