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 には、CharByteInt16UInt16Int32UInt32Int64UInt64SingleDoubleDateTimeBooleanStringDecimal の各型の値、またはこれらのデータ型 (許可されていない String を除く) の配列を指定する必要があります。

例外

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便利です。

適用対象

こちらもご覧ください