Stroke.AddPropertyData(Guid, Object) Methode

Definition

Fügt dem Stroke Objekt eine benutzerdefinierte Eigenschaft hinzu.

public:
 void AddPropertyData(Guid propertyDataId, System::Object ^ propertyData);
public void AddPropertyData(Guid propertyDataId, object propertyData);
member this.AddPropertyData : Guid * obj -> unit
Public Sub AddPropertyData (propertyDataId As Guid, propertyData As Object)

Parameter

propertyDataId
Guid

Der eindeutige Bezeichner für die Eigenschaft.

propertyData
Object

Der Wert der benutzerdefinierten Eigenschaft. propertyDatamuss vom Typ Char, , , ByteInt16, UInt16, , Int32, UInt32, Int64UInt64, Single, DoubleDateTime, Booleanoder String ein Array dieser Datentypen sein, mit AusnahmeDecimal, das nicht zulässig Stringist.

Ausnahmen

Das propertyData Argument ist keine der zulässigen Datentypen, die Parameters im Abschnitt aufgeführt sind.

Beispiele

Im folgenden Beispiel wird das Hinzufügen einer benutzerdefinierten Eigenschaft zu einem Stroke Objekt veranschaulicht.

// Create a guid for the date/timestamp.
Guid dtGuid = new Guid("03457307-3475-3450-3035-640435034540");

DateTime now = DateTime.Now;

// Check whether the property is already saved
if (thisStroke.ContainsPropertyData(dtGuid))
{
    // Check whether the existing property matches the current date/timestamp
    DateTime oldDT = (DateTime)thisStroke.GetPropertyData(dtGuid);

    if (oldDT != now)
    {
        // Update the current date and time
        thisStroke.AddPropertyData(dtGuid, now);
    }
}
' Create a guid for the date/timestamp.
Dim dtGuid As New Guid("03457307-3475-3450-3035-640435034540")

Dim now As DateTime = DateTime.Now

' Check whether the property is already saved
If thisStroke.ContainsPropertyData(dtGuid) Then
    ' Check whether the existing property matches the current date/timestamp
    Dim oldDT As DateTime = CType(thisStroke.GetPropertyData(dtGuid), DateTime)

    If oldDT <> now Then
        ' Update the current date and time
        thisStroke.AddPropertyData(dtGuid, now)
    End If
End If

Hinweise

Diese Methode ist nützlich, wenn Sie zusätzliche Informationen in der Stroke.

Gilt für:

Weitere Informationen