本文整理汇总了C#中System.Windows.Ink.Stroke.AddPropertyData方法的典型用法代码示例。如果您正苦于以下问题:C# Stroke.AddPropertyData方法的具体用法?C# Stroke.AddPropertyData怎么用?C# Stroke.AddPropertyData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Ink.Stroke
的用法示例。
在下文中一共展示了Stroke.AddPropertyData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: inkCScribble_MouseUp
private void inkCScribble_MouseUp(object sender, MouseButtonEventArgs e)
{
if (inkCScribble.Strokes.Count > 0)
{
currentStroke = inkCScribble.Strokes[inkCScribble.Strokes.Count - 1];
currentStroke.AddPropertyData(strokeObjectPropertyID, Guid.NewGuid().ToString());
}
if (CurrentTool == ActiveReadingTool.Pen) //add strokes to Document (when strokes are close to each other cluster them in one strokeCollection)
{
foreach (ScribbleCollection collection in ActualDocument[ActualPage].ScribblingCollections)
{
if (Distance(currentStroke.GetBounds().TopLeft, new System.Windows.Point(collection.X, collection.Y)) < defaultClusterStrokeDistanceCm ||
Distance(currentStroke.GetBounds().BottomRight, new System.Windows.Point(collection.X, collection.Y)) < defaultClusterStrokeDistanceCm)
{
if (!collection.Scribbles.Contains(currentStroke))
{
collection.Scribbles.Add(currentStroke);
currentStroke.AddPropertyData(strokeCollectionPropertyID, collection.ID.ToString());
//creates a point for undo for this action
PushToUndoStack(ActiveReadingTool.Pen, collection, currentStroke);
}
return;
}
}
//if stroke is not close to another one, create new collection
ScribbleCollection newCollection = new ScribbleCollection();
newCollection.Scribbles = new StrokeCollection();
newCollection.Scribbles.Add(currentStroke);
currentStroke.AddPropertyData(strokeCollectionPropertyID, newCollection.ID.ToString());
ActualDocument[ActualPage].ScribblingCollections.Add(newCollection);
//creates a point for undo for this action
PushToUndoStack(ActiveReadingTool.Pen, newCollection);
}
else if (CurrentTool == ActiveReadingTool.Eraser)
inkCScribble.Strokes.Remove(currentStroke); //remove red eraser stroke
}