WebBrowsableAttribute 類別

定義

指出 Web 組件控制項指定的屬性是否顯示在 PropertyGridEditorPart 物件中。

public ref class WebBrowsableAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Property)]
public sealed class WebBrowsableAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Property)>]
type WebBrowsableAttribute = class
    inherit Attribute
Public NotInheritable Class WebBrowsableAttribute
Inherits Attribute
繼承
WebBrowsableAttribute
屬性

範例

下列程式碼範例示範如何使用 WebBrowsableAttribute 屬性,將網頁元件控制項上的屬性標示為可在 控制項中顯示的 PropertyGridEditorPart 屬性。 此範例是類別概觀中找到較大範例的 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

備註

控制項 PropertyGridEditorPart 提供一般使用者介面 (UI) ,讓使用者編輯位於區域中的自訂屬性 WebPart 和伺服器控制項 WebPartZoneBase 。 編輯 UI 是針對在原始程式碼中標示的屬性,其 WebBrowsable 屬性會從 WebBrowsableAttribute 類別) (。 當屬性標示為這個屬性時, PropertyGridEditorPart 控制項會根據屬性的類型建立編輯 UI,並視需要使用 PropertyDescriptor 物件,將每個編輯控制項中的值轉換成屬性的類型。

建構函式

WebBrowsableAttribute()

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

WebBrowsableAttribute(Boolean)

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

欄位

Default

WebBrowsableAttribute 屬性設為預設值 (也就是 false),表示 Browsable 類別的執行個體。

No

WebBrowsableAttribute 屬性設定成 false,表示 Browsable 類別的新執行個體。

Yes

WebBrowsableAttribute 屬性設定成 true,表示 Browsable 類別的新執行個體。

屬性

Browsable

取得值,指出 PropertyGridEditorPart 控制項是否應顯示 Web 組件控制項的特定屬性。

TypeId

在衍生類別中實作時,取得這個 Attribute 的唯一識別碼。

(繼承來源 Attribute)

方法

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。

GetHashCode()

傳回顯示名稱值的雜湊程式碼。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IsDefaultAttribute()

判斷目前的執行個體是否設為預設值。

Match(Object)

在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。

(繼承來源 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。

(繼承來源 Attribute)

適用於