Version

Image Property (ButtonAppearance)

Image displayed on control.
Syntax
'Declaration
 
Public ReadOnly Property Image As Image
public Image Image {get;}
Remarks

Notes:

1. If Url of image for button in normal state is not set, then image is not rendered for any state of button.

2. Width, Height and AlternateText properties have effect only for Appearance.Image (when button in normal state).

3. The Attributes property is not used for any state of button.

Example
The ButtonAppearance related properties allows to configure appearance of button for a particular state. That allows to configure colors, borders, images, fonts, etc. If a property for a particular state is not set, then the corresponding property of the appearance for the normal state of button is used automatically. If the UseBrowserDefaults is enabled and the appearances are not set, then the defaults for a particular browser are used automatically.

' image for normal state of button
Me.WebImageButton1.Appearance.Image.Url = "./images/normalStateImage.gif"
' alt/tooltip for image
Me.WebImageButton1.Appearance.Image.AlternateText = "This is a submit button"
' optional size of images for all states of button
Me.WebImageButton1.Appearance.Image.Width = Unit.Pixel(16)
Me.WebImageButton1.Appearance.Image.Height = Unit.Pixel(16)
' image for mouse-over state of button
' Note: tooltip and size for all states of button besides normal can not be customized
Me.WebImageButton1.HoverAppearance.Image.Url = "./images/mouseOverStateImage.gif"
' background for button in focus state
' Note: on the client side the Focus and Hover appearances are merged to build mouseover-focus appearance.
Me.WebImageButton1.FocusAppearance.Style.BackColor = Color.Orange
' background for button in normal state
Me.WebImageButton1.Appearance.Style.BackColor = Color.Red
' background for button in pressed state
Me.WebImageButton1.PressedAppearance.Style.BackColor = Color.Green
' foreground for button in disabled state
Me.WebImageButton1.DisabledAppearance.Style.ForeColor = Color.Gray
' inner top border of button in pressed state
Me.WebImageButton1.PressedAppearance.InnerBorder.ColorTop = Color.Black
Me.WebImageButton1.PressedAppearance.InnerBorder.StyleTop = BorderStyle.Dotted
Me.WebImageButton1.PressedAppearance.InnerBorder.WidthTop = Unit.Pixel(1)
' shift text and image 1 pixel down in pressed state compare to the position of text and image in normal state
Me.WebImageButton1.PressedAppearance.ContentShift = Infragistics.WebUI.WebControls.ButtonContentShiftType.Down


' Note: if codes above are written within aspx, then it reduces the size of hidden ViewState passed to client
// image for normal state of button
this.WebImageButton1.Appearance.Image.Url = "./images/normalStateImage.gif";
// alt/tooltip for image
this.WebImageButton1.Appearance.Image.AlternateText = "This is a submit button";
// optional size of images for all states of button
this.WebImageButton1.Appearance.Image.Width = Unit.Pixel(16);
this.WebImageButton1.Appearance.Image.Height = Unit.Pixel(16);
// image for mouse-over state of button
// Note: tooltip and size for all states of button besides normal can not be customized
this.WebImageButton1.HoverAppearance.Image.Url = "./images/mouseOverStateImage.gif";
// background for button in focus state
// Note: on the client side the Focus and Hover appearances are merged to build mouseover-focus appearance.
this.WebImageButton1.FocusAppearance.Style.BackColor = Color.Orange;
// background for button in normal state

// Note: if codes above are written within aspx, then it reduces the size of hidden ViewState passed to client
this.WebImageButton1.Appearance.Style.BackColor = Color.Red;
// background for button in pressed state
this.WebImageButton1.PressedAppearance.Style.BackColor = Color.Green;
// foreground for button in disabled state
this.WebImageButton1.DisabledAppearance.Style.ForeColor = Color.Gray;
// inner top border of button in pressed state
this.WebImageButton1.PressedAppearance.InnerBorder.ColorTop = Color.Black;
this.WebImageButton1.PressedAppearance.InnerBorder.StyleTop = BorderStyle.Dotted;
this.WebImageButton1.PressedAppearance.InnerBorder.WidthTop = Unit.Pixel(1);
// shift text and image 1 pixel down in pressed state compare to position of text and image in normal state
this.WebImageButton1.PressedAppearance.ContentShift = Infragistics.WebUI.WebControls.ButtonContentShiftType.Down;
Requirements

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