StrokeCollection.GetPropertyData(Guid) 메서드

정의

지정된 속성과 연결된 사용자 지정 속성의 값을 반환합니다 Guid.

public:
 System::Object ^ GetPropertyData(Guid propertyDataId);
public object GetPropertyData(Guid propertyDataId);
member this.GetPropertyData : Guid -> obj
Public Function GetPropertyData (propertyDataId As Guid) As Object

매개 변수

propertyDataId
Guid

Guid 가져올 사용자 지정 속성과 연결된 속성입니다.

반품

지정 Guid한 속성과 연결된 사용자 지정 속성의 값입니다.

예외

propertyDataId가 .의 사용자 지정 속성과 연결되지 않은 경우 StrokeCollection

예제

다음 예제에서는 사용자 지정 속성 데이터를 추가하고 가져오는 방법을 보여 줍니다. 메서드는 AddTimeStamp_Click 메서드를 AddPropertyData 사용하여 현재 시간을 .에 추가합니다 StrokeCollection. 메서드는 GetTimeStap_Click 메서드를 GetPropertyData 사용하여 .에서 타임스탬프를 검색합니다 StrokeCollection. 이 예제에서는 호출InkCanvas된 .가 있다고 가정합니다inkCanvas1.

Guid timestamp = new Guid("12345678-9012-3456-7890-123456789012");

// Add a timestamp to the StrokeCollection.
private void AddTimestamp_Click(object sender, RoutedEventArgs e)
{

    inkCanvas1.Strokes.AddPropertyData(timestamp, DateTime.Now);
}

// Get the timestamp of the StrokeCollection.
private void GetTimestamp_Click(object sender, RoutedEventArgs e)
{

    if (inkCanvas1.Strokes.ContainsPropertyData(timestamp))
    {
        object date = inkCanvas1.Strokes.GetPropertyData(timestamp);

        if (date is DateTime)
        {
            MessageBox.Show("This StrokeCollection's timestamp is " +
                ((DateTime)date).ToString());
        }
    }
    else
    {
        MessageBox.Show(
            "The StrokeCollection does not have a timestamp.");
    }
}
Private timestamp As New Guid("12345678-9012-3456-7890-123456789012")

' Add a timestamp to the StrokeCollection.
Private Sub AddTimestamp_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    inkCanvas1.Strokes.AddPropertyData(timestamp, DateTime.Now)

End Sub

' Get the timestamp of the StrokeCollection.
Private Sub GetTimestamp_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    If inkCanvas1.Strokes.ContainsPropertyData(timestamp) Then

        Dim savedDate As Object = inkCanvas1.Strokes.GetPropertyData(timestamp)

        If TypeOf savedDate Is DateTime Then
            MessageBox.Show("This StrokeCollection's timestamp is " & _
                CType(savedDate, DateTime).ToString())
        End If
    Else
        MessageBox.Show("The StrokeCollection does not have a timestamp.")
    End If

End Sub

설명

AddPropertyDataGetPropertyData 메서드를 사용하면 사용자 지정 속성을 에 추가할 수 있습니다StrokeCollection. 그런 다음 , 를 사용하여 추가 정보를 포함할 StrokeCollection수 있습니다.

적용 대상