StrokeCollection.AddPropertyData(Guid, Object) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
에 사용자 지정 속성을 StrokeCollection추가합니다.
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)
매개 변수
- propertyData
- Object
사용자 지정 속성의 값입니다.
propertyData는 허용되지 않는 경우를 제외하고 이러한 데이터 형식의 CharByteInt16UInt16Int32UInt32Int64UInt64SingleDoubleDateTimeBooleanStringDecimal 배열, 또는 이러한 데이터 형식의 배열이어야 합니다.String
예외
예제
다음 예제에서는 사용자 지정 속성 데이터를 추가하고 가져오는 방법을 보여 줍니다. 메서드는 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 메서드를 사용하면 사용자 지정 속성을 에 추가할 수 있습니다 StrokeCollection. 그런 다음 , 를 사용하여 추가 정보를 포함할 StrokeCollection수 있습니다.