PropertyValueUIItem(Image, PropertyValueUIItemInvokeHandler, String) Konstruktor
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Initialisiert eine neue Instanz der PropertyValueUIItem-Klasse.
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);
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)
Parameter
- uiItemImage
- Image
Das anzuzeigende Symbol. Das Bild muss eine Größe von 8 x 8 Pixel haben.
- handler
- PropertyValueUIItemInvokeHandler
Der Handler, der bei einem Doppelklick auf das Bild aufgerufen werden soll.
- tooltip
- String
Die ToolTip-Eigenschaft, die für die Eigenschaft angezeigt werden soll, der diese PropertyValueUIItem-Klasse zugeordnet ist.
Ausnahmen
uiItemImage oder handler ist null.
Beispiele
Im folgenden Codebeispiel wird ein PropertyValueUIItem Objekt für alle Eigenschaften der Komponente namens HorizontalMargin oder VerticalMargin. Die PropertyValueUIItem für diese Eigenschaften bereitgestellten Eigenschaften stellen ein Bild, eine QuickInfo und einen Ereignishandler bereit, der ein Meldungsfeld anzeigt, wenn auf das Bild für die Eigenschaft geklickt wird. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die IPropertyValueUIService Schnittstelle bereitgestellt wird.
// PropertyValueUIHandler delegate that provides PropertyValueUIItem
// objects to any properties named horizontalMargin or verticalMargin.
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 = DeserializeFromBase64Text( imageBlob1 );
itemList->Add( gcnew PropertyValueUIItem( img,gcnew PropertyValueUIItemInvokeHandler( this, &PropertyUIComponent::marginInvoke ),"Test ToolTip" ) );
}
if ( propDesc->DisplayName->Equals( "verticalMargin" ) )
{
Image^ img = DeserializeFromBase64Text( imageBlob1 );
img->RotateFlip( RotateFlipType::Rotate90FlipNone );
itemList->Add( gcnew PropertyValueUIItem( img,gcnew PropertyValueUIItemInvokeHandler( this, &PropertyUIComponent::marginInvoke ),"Test ToolTip" ) );
}
}
// 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 = DeserializeFromBase64Text(imageBlob1);
itemList.Add( new PropertyValueUIItem( img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip") );
}
if( propDesc.DisplayName.Equals( "VerticalMargin" ) )
{
Image img = DeserializeFromBase64Text(imageBlob1);
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
itemList.Add( new PropertyValueUIItem( img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip") );
}
}
' PropertyValueUIHandler delegate that provides PropertyValueUIItem
' objects to any properties named HorizontalMargin or VerticalMargin.
Private Sub marginPropertyValueUIHandler(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal propDesc As System.ComponentModel.PropertyDescriptor, ByVal itemList As ArrayList)
' 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") Then
Dim img As Image = DeserializeFromBase64Text(imageBlob1)
itemList.Add(New PropertyValueUIItem(img, New PropertyValueUIItemInvokeHandler(AddressOf Me.marginInvoke), "Test ToolTip"))
End If
If propDesc.DisplayName.Equals("VerticalMargin") Then
Dim img As Image = DeserializeFromBase64Text(imageBlob1)
img.RotateFlip(RotateFlipType.Rotate90FlipNone)
itemList.Add(New PropertyValueUIItem(img, New PropertyValueUIItemInvokeHandler(AddressOf Me.marginInvoke), "Test ToolTip"))
End If
End Sub