When set to a color other than Color.Transparent (the default), all occurrences of the color in the image will be made transparent.
If an image is supplied by setting an Appearance.Image property to an Imagelist index, the ImageLists TransparentColor property is looked at first. If that property is set to Color.TransparentColor, then the component's ImageTransparentColor is used. If it is set to Color.TransparentColor, then no color masking is done.
If an image is supplied by setting the Appearance.Image property to an image, the component's ImageTransparentColor is used. If it is set to Color.TransparentColor, then no color masking is done.
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; }
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