WebDescriptionAttribute 类  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
定义作为 Web 部件控件属性的工具提示使用的字符串值。
public ref class WebDescriptionAttribute : Attribute[System.AttributeUsage(System.AttributeTargets.Property)]
public class WebDescriptionAttribute : Attribute[<System.AttributeUsage(System.AttributeTargets.Property)>]
type WebDescriptionAttribute = class
    inherit AttributePublic Class WebDescriptionAttribute
Inherits Attribute- 继承
- 属性
示例
下面的代码示例演示如何使用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) ,使用户可以编辑位于WebPartZoneBase区域中的WebPart自定义属性和服务器控件。 为源代码中标记的属性提供了编辑 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) | 将一组名称映射为对应的一组调度标识符。(继承自 Attribute) | 
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) | 检索对象的类型信息,然后可以使用该信息获取接口的类型信息。(继承自 Attribute) | 
| _Attribute.GetTypeInfoCount(UInt32) | 检索对象提供的类型信息接口的数量(0 或 1)。(继承自 Attribute) | 
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) | 提供对某一对象公开的属性和方法的访问。(继承自 Attribute) |