共用方式為


WebBrowsableAttribute 建構函式

定義

初始化 WebBrowsableAttribute 類別的新執行個體。

多載

名稱 Description
WebBrowsableAttribute()

WebBrowsableAttribute 屬性設定成 true 來初始化 Browsable 類別的新執行個體。

WebBrowsableAttribute(Boolean)

使用 WebBrowsableAttribute 屬性的特定值,初始化 Browsable 類別的新執行個體。

WebBrowsableAttribute()

WebBrowsableAttribute 屬性設定成 true 來初始化 Browsable 類別的新執行個體。

public:
 WebBrowsableAttribute();
public WebBrowsableAttribute();
Public Sub New ()

範例

下列程式碼範例示範如何使用 WebBrowsableAttribute 屬性將 Web 元件控制項上的屬性標示為可在控制項中顯示的 PropertyGridEditorPart 屬性。 屬性會透過 WebBrowsableAttribute 建構函式設定為可流覽。 此範例是類別概觀中找到較大範例的 PropertyGridEditorPart 一部分。

[Personalizable(), WebBrowsable(), WebDisplayName("Job Type"), 
  WebDescription("Select the category that corresponds to your job.")]
public JobTypeName UserJobType
{
  get
  {
    object o = ViewState["UserJobType"];
    if (o != null)
      return (JobTypeName)o;
    else
      return _userJobType;
  }

  set { _userJobType = (JobTypeName)value; }
}
<Personalizable(), WebBrowsable(), WebDisplayName("Job Type"), _
  WebDescription("Select the category that corresponds to your job.")> _
Public Property UserJobType() As JobTypeName
  Get
    Dim o As Object = ViewState("UserJobType")
    If Not (o Is Nothing) Then
      Return CType(o, JobTypeName)
    Else
      Return _userJobType
    End If
  End Get
  Set(ByVal value As JobTypeName)
    _userJobType = CType(value, JobTypeName)
  End Set
End Property

備註

當屬性透過 C# 或 <WebBrowsable()> Visual Basic 中的屬性宣告 [WebBrowsable()] 套用時 WebBrowsable ,就會 WebBrowsableAttribute 使用建構函式。

適用於

WebBrowsableAttribute(Boolean)

使用 WebBrowsableAttribute 屬性的特定值,初始化 Browsable 類別的新執行個體。

public:
 WebBrowsableAttribute(bool browsable);
public WebBrowsableAttribute(bool browsable);
new System.Web.UI.WebControls.WebParts.WebBrowsableAttribute : bool -> System.Web.UI.WebControls.WebParts.WebBrowsableAttribute
Public Sub New (browsable As Boolean)

參數

browsable
Boolean

布林值,指出屬性是否應顯示在 PropertyGridEditorPart

備註

當屬性透過具有布林值的屬性宣告套用時 WebBrowsable ,會 WebBrowsableAttribute 使用 建構函式。 若要防止在控制項中 PropertyGridEditorPart 顯示內容,屬性可以標示為 C# 或 <WebBrowsable(false)> Visual Basic 中的 屬性 [WebBrowsable(false)]

適用於