バージョン

Image プロパティ (ButtonAppearance)

画像をコントロール上に表示します。
シンタックス
'宣言
 
Public ReadOnly Property Image As Image
public Image Image {get;}
解説

注:

1.標準状態のボタンの画像のUrlが設定されない場合、画像はボタンの任意の状態に対して要求されません。

2.Width、HeightおよびAlternateTextプロパティはAppearance.Imageにのみ効果があります。

3.属性プロパティはボタンのいくつかの状態のために使用されません。

使用例
' 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;
参照