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 特性将工具提示分配给 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自定义属性和服务器控件。 为源代码中 WebBrowsable 标记的属性(从 WebBrowsableAttribute 类)提供编辑 UI。 使用此属性标记属性时,控件 PropertyGridEditorPart 会基于属性的类型创建编辑 UI,并根据需要使用 PropertyDescriptor 对象将每个编辑控件中的值转换为属性的类型。

通过 WebDescription 属性(来自 WebDescriptionAttribute 类),可以在鼠标指针放置在控件上时,指定在编辑 UI 中随每个控件一起出现的工具提示。

构造函数

名称 说明
WebDescriptionAttribute()

初始化 WebDescriptionAttribute 类的新实例。

WebDescriptionAttribute(String)

使用指定的说明初始化类的新实例 WebDescriptionAttribute

字段

名称 说明
Default

表示将属性设置为空字符串(“)的 WebDescriptionAttributeDescription 的实例。

属性

名称 说明
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)

将一组名称映射为对应的一组调度标识符。

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,该信息可用于获取接口的类型信息。

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对对象公开的属性和方法的访问。

(继承自 Attribute)

适用于