StrokeCollection.AddPropertyData(Guid, Object) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
öğesine StrokeCollectionözel bir özellik ekler.
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)
Parametreler
- propertyData
- Object
Özel özelliğin değeri. propertyData
, , , , , UInt16, UInt32Int32, , , Int64, , UInt64, , DoubleBooleanSingleDateTimeDecimalStringveya bu veri türlerinden oluşan bir dizi türünde olmalıdırChar, ancak Stringbuna izin verilmez. Int16Byte
Özel durumlar
propertyDataId
boş Guidbir .
-veya-
propertyData
bölümünde listelenen Parameters
izin verilen veri türlerinden biri değildir.
Örnekler
Aşağıdaki örnekte özel özellik verilerini ekleme ve alma işlemleri gösterilmektedir. AddTimeStamp_Click
yöntemi, AddPropertyData geçerli saati öğesine eklemek için StrokeCollectionyöntemini kullanır. GetTimeStap_Click
yöntemi, zaman damgasını içinden StrokeCollectionalmak için yöntemini kullanırGetPropertyData. Bu örnekte adlı inkCanvas1
bir InkCanvas olduğu varsayılır.
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
Açıklamalar
yöntemi, AddPropertyData öğesine özel özellikler eklemenize StrokeCollectionolanak tanır. Daha sonra ile StrokeCollectionek bilgiler ekleyebilirsiniz.
Şunlara uygulanır
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin