バージョン

ContentShift プロパティ

通常状態のボタンのテキストと画像の位置に相対して、テキストと画像の位置をシフトします。
シンタックス
'宣言
 
Public Property ContentShift As ButtonContentShiftType
public ButtonContentShiftType ContentShift {get; set;}
解説

注: {1}。このプロパティは、通常状態のボタンに対して機能しません (WebButtonBase.Appearance.ContentShift)。

2.通常状態のボタンの Padding プロパティがピクセル以外の単位に設定されている場合、このプロパティは機能しません。

3.押された状態のボタンに対するこのプロパティの値が NotSet の場合、押されたボタンの DownRight の値が使用されます。

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