当前位置: 首页>>代码示例>>C#>>正文


C# Stroke.AddPropertyData方法代码示例

本文整理汇总了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
        }
开发者ID:hcilab-um,项目名称:tPad,代码行数:40,代码来源:ActiveReaderApp.xaml.cs


注:本文中的System.Windows.Ink.Stroke.AddPropertyData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。