WebDescriptionAttribute 建構函式

定義

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

多載

WebDescriptionAttribute()

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

WebDescriptionAttribute(String)

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

WebDescriptionAttribute()

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

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

備註

建構函式 WebDescriptionAttribute 會將 Description 屬性設定為空字串 (「」) 。

適用於

WebDescriptionAttribute(String)

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

public:
 WebDescriptionAttribute(System::String ^ description);
public WebDescriptionAttribute (string description);
new System.Web.UI.WebControls.WebParts.WebDescriptionAttribute : string -> System.Web.UI.WebControls.WebParts.WebDescriptionAttribute
Public Sub New (description As String)

參數

description
String

要在 PropertyGridEditorPart 中使用的工具提示。

範例

下列程式碼範例示範如何使用 WebDescriptionAttribute 屬性,將 ToolTip 指派給Web 組件控制項上的屬性。 自訂 UserJobType 屬性會提供工具提示「選取對應至作業的類別」。 顯示于 控制項中 PropertyGridEditorPart 。 工具提示是透過建 WebDescriptionAttribute 構函式指派。 此範例是類別概觀中找到較大範例的 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

備註

建構函式 WebDescriptionAttribute 會將 Description 屬性設定為 description 。 參數 description 是值,其會顯示為 控制項中屬性的工具 PropertyGridEditorPart 提示。

適用於