Stroke.AddPropertyData(Guid, Object) Methode

Definitie

Hiermee voegt u een aangepaste eigenschap toe aan het Stroke object.

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)

Parameters

propertyDataId
Guid

De unieke id voor de eigenschap.

propertyData
Object

De waarde van de aangepaste eigenschap. propertyDatamoet van het type Char, Byte, Int16, UInt16, Int32UInt32Int64, UInt64, Single, , DoubleDateTime, Boolean, StringDecimal of een matrix van deze gegevenstypen zijn, behalve String, die niet is toegestaan.

Uitzonderingen

Het propertyData argument is geen van de toegestane gegevenstypen die in de Parameters sectie worden vermeld.

Voorbeelden

In het volgende voorbeeld ziet u hoe u een aangepaste eigenschap toevoegt aan een Stroke object.

// 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

Opmerkingen

Deze methode is handig als u extra informatie moet opslaan in de Stroke.

Van toepassing op

Zie ook