Stroke.AddPropertyData(Guid, Object) Metoda

Definicja

Dodaje właściwość niestandardową Stroke do obiektu.

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)

Parametry

propertyDataId
Guid

Unikatowy identyfikator właściwości.

propertyData
Object

Wartość właściwości niestandardowej. propertyDatamusi mieć typ Char, , , Int16UInt16Int64UInt64UInt32DateTimeDecimal Int32ByteDoubleBooleanSingleStringlub tablicę tych typów danych, z wyjątkiem String, które nie są dozwolone.

Wyjątki

Argument propertyData nie jest jednym z dozwolonych typów danych wymienionych w Parameters sekcji.

Przykłady

W poniższym przykładzie pokazano, jak dodać właściwość niestandardową Stroke do obiektu.

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

Uwagi

Ta metoda jest przydatna, jeśli musisz przechowywać dodatkowe informacje w pliku Stroke.

Dotyczy

Zobacz też