PropertyValueUIItem(Image, PropertyValueUIItemInvokeHandler, String) Construtor
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Inicializa uma nova instância da PropertyValueUIItem classe.
public:
PropertyValueUIItem(System::Drawing::Image ^ uiItemImage, System::Drawing::Design::PropertyValueUIItemInvokeHandler ^ handler, System::String ^ tooltip);
public PropertyValueUIItem(System.Drawing.Image uiItemImage, System.Drawing.Design.PropertyValueUIItemInvokeHandler handler, string tooltip);
public PropertyValueUIItem(System.Drawing.Image uiItemImage, System.Drawing.Design.PropertyValueUIItemInvokeHandler handler, string? tooltip);
new System.Drawing.Design.PropertyValueUIItem : System.Drawing.Image * System.Drawing.Design.PropertyValueUIItemInvokeHandler * string -> System.Drawing.Design.PropertyValueUIItem
Public Sub New (uiItemImage As Image, handler As PropertyValueUIItemInvokeHandler, tooltip As String)
Parâmetros
- uiItemImage
- Image
O ícone a mostrar. A imagem deve ter 8 x 8 píxeis.
- handler
- PropertyValueUIItemInvokeHandler
O handler a invocar quando a imagem é dupla clique.
- tooltip
- String
O ToolTip para mostrar para a propriedade a que isto PropertyValueUIItem está associado.
Exceções
uiItemImage ou handler é null.
Exemplos
O seguinte exemplo de código fornece um PropertyValueUIItem objeto para quaisquer propriedades do componente nomeado HorizontalMargin ou VerticalMargin. O PropertyValueUIItem para estas propriedades fornece uma imagem, uma dica de ferramenta e um handler de eventos que exibe uma caixa de mensagem quando a imagem da propriedade é clicada. Este exemplo de código faz parte de um exemplo maior fornecido para a IPropertyValueUIService interface.
// 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"));
}
}