WebDescriptionAttribute 類別

定義

定義字串值,做為 Web 組件控制項之屬性的工具提示。

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

範例

下列程式碼範例示範如何使用 WebDescriptionAttribute 屬性,將 ToolTip 指派給Web 組件控制項上的屬性。 自訂 UserJobType 屬性會提供工具提示「選取對應至作業的類別」。 顯示于 控制項中 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 物件,將每個編輯控制項中的值轉換成屬性的類型。

屬性 WebDescription (類別 WebDescriptionAttribute) 可讓您指定當滑鼠指標放在控制項上方時,在編輯 UI 中顯示每個控制項的工具提示。

建構函式

WebDescriptionAttribute()

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

WebDescriptionAttribute(String)

使用指定的描述,初始化 WebDescriptionAttribute 類別的新執行個體。

欄位

Default

WebDescriptionAttribute 屬性設為空字串 (""),表示 Description 類別的執行個體。

屬性

Description

取得顯示在 PropertyGridEditorPart 控制項中屬性的工具提示。

DescriptionValue

取得或設定顯示於 PropertyGridEditorPart 控制項的工具提示。

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)

適用於