Stroke.AddPropertyData(Guid, Object) メソッド

定義

Stroke オブジェクトにカスタム プロパティを追加します。

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)

パラメーター

propertyDataId
Guid

プロパティの一意識別子。

propertyData
Object

カスタム プロパティの値を指定します。 propertyDataは、許可されないCharを除き、ByteInt16UInt16Int32UInt32Int64UInt64SingleDoubleDateTimeBooleanStringDecimalString、またはこれらのデータ型の配列である必要があります。

例外

propertyData引数は、Parameters セクションに記載されている許可されるデータ型の 1 つではありません。

次の例では、 Stroke オブジェクトにカスタム プロパティを追加する方法を示します。

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

注釈

この方法は、 Strokeに追加情報を格納する必要がある場合に便利です。

適用対象

こちらもご覧ください