'宣言 Public ReadOnly Property PressedAppearance As ButtonAppearance
public ButtonAppearance PressedAppearance {get;}
' 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;