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


C# Stroke.Clone方法代码示例

本文整理汇总了C#中System.Windows.Ink.Stroke.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Stroke.Clone方法的具体用法?C# Stroke.Clone怎么用?C# Stroke.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Ink.Stroke的用法示例。


在下文中一共展示了Stroke.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: newStroke

        /// <summary>
        /// Analyze a new stroke.
        /// </summary>
        /// <param name="stroke"></param>
        /// <returns>true if the stroke was recognized as belonging to a graph (and so should be excluded from InkAnalyzer)</returns>
        public bool newStroke(Stroke stroke)
        {
            if (strokes.ContainsKey(stroke))
            {
                // already have it!
                return true;
            }
            foreach (Graph g in graphs)
            {
                if (g.containsStroke(stroke) && g.takeStroke(stroke))
                {
                    strokes.Add(stroke, g);
                    return true;
                }
            }
            Stroke copy = stroke.Clone();
            analyzer.AddStroke(copy);

            analyzer.Analyze();

            StrokeCollection sc = new StrokeCollection(new Stroke[] { copy });
            ContextNodeCollection ctxNodes = analyzer.FindInkLeafNodes(sc);
            foreach (ContextNode ctxNode in ctxNodes)
            {
                if (ctxNode is InkDrawingNode && (ctxNode as InkDrawingNode).GetShapeName() == "Rectangle")
                {
                    Graph g = new XYGraph(this, stroke);
                    graphs.Add(g);
                    strokes.Add(stroke, g);
                    analyzer.RemoveStroke(copy);
                    return true;
                }
            }
            analyzer.RemoveStroke(copy);
            return false;
        }
开发者ID:rudi-c,项目名称:htn-stylus,代码行数:41,代码来源:GraphAnalyzer.cs

示例2: doMyStrokeAdded

 public void doMyStrokeAdded(Stroke stroke, string intendedPrivacy)
 {
     doMyStrokeAddedExceptHistory(stroke, intendedPrivacy);
     var thisStroke = stroke.Clone();
     UndoHistory.Queue(
         () =>
         {
             ClearAdorners();
             var existingStroke = Strokes.Where(s => s.sum().checksum == thisStroke.sum().checksum).FirstOrDefault();
             if (existingStroke != null)
             {
                 Strokes.Remove(existingStroke);
                 doMyStrokeRemovedExceptHistory(existingStroke);
             }
         },
         () =>
         {
             ClearAdorners();
             if (Strokes.Where(s => s.sum().checksum == thisStroke.sum().checksum).Count() == 0)
             {
                 Strokes.Add(thisStroke);
                 doMyStrokeAddedExceptHistory(thisStroke, thisStroke.tag().privacy);
             }
             if(EditingMode == InkCanvasEditingMode.Select)
                 Select(new StrokeCollection(new [] {thisStroke}));
             addAdorners();
         });
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:28,代码来源:HandWriting.cs

示例3: DrawLeapTouch

        protected void DrawLeapTouch(Leap.Frame frame)
        {
            InteractionBox interactionBox = frame.InteractionBox;

            if (frame.Pointables.Extended().Count != 1)
            {
                return;
            }

            Pointable pointable = frame.Pointables.Extended()[0];

            // InteractionBox を利用した座標変換
            Leap.Vector normalizedPosition = interactionBox.NormalizePoint(pointable.StabilizedTipPosition);

            double tx = normalizedPosition.x * windowWidth;
            double ty = windowHeight - normalizedPosition.y * windowHeight;
            StylusPoint touchPoint = new StylusPoint(tx, ty);
            StylusPointCollection tips = new StylusPointCollection(new StylusPoint[] { touchPoint });

            // タッチ状態
            if (normalizedPosition.z <= TouchBorder)
            {
                Stroke touchStroke = new Stroke(tips, touchIndicator);
                this.InkCanvas_LeapPaintLine.Strokes.Add(touchStroke.Clone());
            }
        }
开发者ID:MaxMEllon,项目名称:LeaPresen,代码行数:26,代码来源:MainWindow.xaml.cs


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