PropertyValueUIItem 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供有关属性窗口中显示的属性的信息,包括关联的事件处理程序、弹出信息字符串以及要为属性显示的图标。
public ref class PropertyValueUIItem
public class PropertyValueUIItem
type PropertyValueUIItem = class
Public Class PropertyValueUIItem
- 继承
-
PropertyValueUIItem
示例
下面的代码示例为名为PropertyValueUIItem或 HorizontalMargin. 的组件的任何属性提供一个VerticalMargin对象。 这些 PropertyValueUIItem 属性提供图像、工具提示和事件处理程序,用于在单击该属性的图像时显示消息框。 此代码示例是为接口提供的大型示例的 IPropertyValueUIService 一部分。
// PropertyValueUIHandler delegate that provides PropertyValueUIItem
// objects to any properties named HorizontalMargin or VerticalMargin.
private void marginPropertyValueUIHandler(
System.ComponentModel.ITypeDescriptorContext context,
System.ComponentModel.PropertyDescriptor propDesc,
ArrayList itemList)
{
// A PropertyValueUIHandler added to the IPropertyValueUIService
// is queried once for each property of a component and passed
// a PropertyDescriptor that represents the characteristics of
// the property when the Properties window is set to a new
// component. A PropertyValueUIHandler can determine whether
// to add a PropertyValueUIItem for the object to its ValueUIItem
// list depending on the values of the PropertyDescriptor.
if (propDesc.DisplayName.Equals("HorizontalMargin"))
{
Image img = Image.FromFile("SampImag.jpg");
itemList.Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip"));
}
if (propDesc.DisplayName.Equals("VerticalMargin"))
{
Image img = Image.FromFile("SampImag.jpg");
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
itemList.Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip"));
}
}
构造函数
| 名称 | 说明 |
|---|---|
| PropertyValueUIItem(Image, PropertyValueUIItemInvokeHandler, String) |
初始化 PropertyValueUIItem 类的新实例。 |
属性
| 名称 | 说明 |
|---|---|
| Image |
获取将在属性窗口中绘制的 8 x 8 像素图像。 |
| InvokeHandler |
获取当用户双击此项时引发的处理程序。 |
| ToolTip |
获取或设置要为此项显示的信息字符串。 |
方法
| 名称 | 说明 |
|---|---|
| Equals(Object) |
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
用作默认哈希函数。 (继承自 Object) |
| GetType() |
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
创建当前 Object的浅表副本。 (继承自 Object) |
| Reset() |
重置用户界面(UI)项。 |
| ToString() |
返回一个表示当前对象的字符串。 (继承自 Object) |