Stroke.AddPropertyData(Guid, Object) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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を除き、Byte、Int16、UInt16、Int32、UInt32、Int64、UInt64、SingleDouble、DateTime、Boolean、String、Decimal、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に追加情報を格納する必要がある場合に便利です。