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입니다.

반환

Object

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

예외

propertyDataIdStrokeCollection의 사용자 지정 속성과 연결되지 않은 경우

예제

다음 예제에서는 사용자 지정 속성 데이터를 가져와 추가 하는 방법을 보여 줍니다. 합니다 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

설명

합니다 AddPropertyData 하 고 GetPropertyData 메서드를 사용 하면 사용자 지정 속성을 추가할 수는 StrokeCollection합니다. 추가 정보를 포함할 수 있습니다는 StrokeCollection합니다.

적용 대상