PropertyValueUIItem(Image, PropertyValueUIItemInvokeHandler, String) Costruttore
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Inizializza una nuova istanza della classe PropertyValueUIItem.
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)
Parametri
- uiItemImage
- Image
Icona da visualizzare. L'immagine deve essere 8 x 8 pixel.
- handler
- PropertyValueUIItemInvokeHandler
Gestore da richiamare quando si fa doppio clic sull'immagine.
- tooltip
- String
Oggetto ToolTip da visualizzare per la proprietà a cui è PropertyValueUIItem associato.
Eccezioni
uiItemImage o handler è null.
Esempio
Nell'esempio di codice seguente viene fornito un PropertyValueUIItem oggetto per tutte le proprietà del componente denominato HorizontalMargin o VerticalMargin. per PropertyValueUIItem queste proprietà fornisce un'immagine, una descrizione comando e un gestore eventi che visualizza una finestra di messaggio quando si fa clic sull'immagine per la proprietà. Questo esempio di codice fa parte di un esempio più ampio fornito per l'interfaccia 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"));
}
}