バージョン

UseBrowserDefaults プロパティ (WebButtonBase)

このプロパティは、外観関連のプロパティを自動的に調整し、クライアント側の特定のブラウザによって使用される編集フィールドとドロップダウン ボタンの各要素の外観に一致させることができます。
シンタックス
'宣言
 
Public Property UseBrowserDefaults As Boolean
public bool UseBrowserDefaults {get; set;}
解説

デフォルト値は true です。

注: 任意の外観関連のプロパティが設定された場合、それらの値は影響を受けず、対応する自動設定のデフォルト値より優先します。

その場合、WebButtonBase は以下の 3 つの定義済みのスタイルだけをサポートします。

  • Windows2000 の Internet Explorer。
  • Netscape Navigator (プラットフォームは関係なし)。
  • WindowsXP の Internet Explorer (blue)。

使用例
' If any background or border related property is set, then they will
' have priority over possible rounded images regardless of the UseBrowserDefaults.
' For example, the following example will draw button with rectangle borders under any browser.
'Me.WebImageButton1.UseBrowserDefaults = True
Me.WebImageButton1.Appearance.Style.BackColor = System.Drawing.SystemColors.Control

' Since the WebImageButton has ability to create RoundedCorners by 2 different ways,
' the UseBrowserDefaults can be combined with the RenderingType.
' The following example under WindowsXP will draw rounded button with WindowsXP-Blue-Theme using
' 1-pixel-table-cells instead of the default background images.
'Me.WebImageButton1.UseBrowserDefaults = True
Me.WebImageButton1.RoundedCorners.RenderingType = Infragistics.WebUI.WebDataInput.ButtonRoundedCornersType.BordersByTableCells
' Note: under Netscape 6.2 and some other browsers, colors of background and borders can be different from the WindowsXP-Blue-Theme.

' If UserBrowserDefaults is disabled, then all appearance related properties are used as they are.
' It means that if nothing is set, then button appears transparent and borderless.
' Below is the simlest example with custom appearances
Me.WebImageButton1.UseBrowserDefaults = False
Me.WebImageButton1.Appearance.Style.BackColor = System.Drawing.SystemColors.Control
Me.WebImageButton1.Appearance.Style.BorderColor = Color.White
Me.WebImageButton1.Appearance.Style.BorderStyle = BorderStyle.Outset
Me.WebImageButton1.Appearance.Style.BorderWidth = Unit.Pixel(1)
Me.WebImageButton1.PressedAppearance.Style.BorderStyle = BorderStyle.Inset

' Note: if codes above are written within aspx, then it reduces the size of hidden ViewState passed to client
// If any background or border related property is set, then they will
// have priority over possible rounded images regardless of the UseBrowserDefaults.
// For example, the following example will draw button with rectangle borders under any browser.
//this.WebImageButton1.UseBrowserDefaults = true;
this.WebImageButton1.Appearance.Style.BackColor = System.Drawing.SystemColors.Control;

// Since the WebImageButton has ability to create RoundedCorners by 2 different ways,
// the UseBrowserDefaults can be combined with the RenderingType.
// The following example under WindowsXP will draw rounded button with WindowsXP-Blue-Theme using
// 1-pixel-table-cells instead of the default background images.
//this.WebImageButton1.UseBrowserDefaults = true;
this.WebImageButton1.RoundedCorners.RenderingType = Infragistics.WebUI.WebDataInput.ButtonRoundedCornersType.BordersByTableCells;
// Note: under Netscape 6.2 and some other browsers, colors of background and borders can be different from the WindowsXP-Blue-Theme.

// If UserBrowserDefaults is disabled, then all appearance related properties are used as they are.
// It means that if nothing is set, then button appears transparent and borderless.
// Below is the simlest example with custom appearances
this.WebImageButton1.UseBrowserDefaults = false;
this.WebImageButton1.Appearance.Style.BackColor = System.Drawing.SystemColors.Control;
this.WebImageButton1.Appearance.Style.BorderColor = Color.White;
this.WebImageButton1.Appearance.Style.BorderStyle = BorderStyle.Outset;
this.WebImageButton1.Appearance.Style.BorderWidth = Unit.Pixel(1);
this.WebImageButton1.PressedAppearance.Style.BorderStyle = BorderStyle.Inset;

// Note: if codes above are written within aspx, then it reduces the size of hidden ViewState passed to client
参照