Infragistics(R) NetAdvantage(R) Windows Forms
ImageSize Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.Misc Namespace > ControlBase Class : ImageSize Property

Gets/sets the size of the image displayed by the control

Syntax

Visual Basic (Declaration) 
Public Property ImageSize As Size
C# 
public Size ImageSize {get; set;}

Example

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

Visual BasicCopy Code
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
C#Copy Code
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;
}

See Also