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


C# Ink.Stroke类代码示例

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


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

示例1: MyIP_MouseLeftButtonDown

        //A new stroke object named MyStroke is created. MyStroke is added to the StrokeCollection of the InkPresenter named MyIP
        private void MyIP_MouseLeftButtonDown(object sender, MouseEventArgs e)
        {
            MyIP.CaptureMouse();
            if (eraseflag == true)
            {

                StylusPointCollection MyStylusPointCollection = new StylusPointCollection();
                MyStylusPointCollection.Add(e.StylusDevice.GetStylusPoints(MyIP));
                NewStroke = new Stroke(MyStylusPointCollection);
                NewStroke.DrawingAttributes.Color = Colors.Red;
                MyIP.Strokes.Add(NewStroke); StylusPointCollection ErasePointCollection = new StylusPointCollection();


            }
            else
            {
                StylusPointCollection pointErasePoints = e.StylusDevice.GetStylusPoints(MyIP);
                StrokeCollection hitStrokes = MyIP.Strokes.HitTest(pointErasePoints);
                if (hitStrokes.Count > 0)
                {
                    foreach (Stroke hitStroke in hitStrokes)
                    {
                        MyIP.Strokes.Remove(hitStroke);
                        //undoStack.Push(hitStroke);
                        //undoStateBufferStack.Push(true);
                    }
                }
            }
        }
开发者ID:TinusGreen,项目名称:GendacProjects,代码行数:30,代码来源:MainPage.xaml.cs

示例2: signaturePad_MouseLeftButtonDown

 private void signaturePad_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     signaturePad.CaptureMouse();
     _currentStroke = new Stroke();
     _currentStroke.StylusPoints.Add(GetStylusPoint(e.GetPosition(signaturePad)));
     _currentStroke.DrawingAttributes.Color = Colors.Blue;
     signaturePad.Strokes.Add(_currentStroke);
 }
开发者ID:KerrN,项目名称:IceHockeyTeam,代码行数:8,代码来源:SignatureView.xaml.cs

示例3: TouchPoint2

 public TouchPoint2(TouchInfo info, UIElement source, StylusPointCollection stylusPoints)
 {
     this.Source = source;
     Stroke = new Stroke(stylusPoints);
     TouchDeviceId = info.TouchDeviceId;
     StartTime = DateTime.Now;
     UpdateTouchInfo(info);
 }
开发者ID:tuliosouza,项目名称:ASG,代码行数:8,代码来源:TouchPoint2.cs

示例4: Stroke_Default_Bounds

		public void Stroke_Default_Bounds ()
		{
			Stroke s = new Stroke ();

			Rect bounds = s.GetBounds ();
			Assert.AreEqual (-1.5, bounds.Top, "Top");
			Assert.AreEqual (-1.5, bounds.Left, "Left");
			Assert.AreEqual (3, bounds.Height, "Height");
			Assert.AreEqual (3, bounds.Width, "Width");
		}
开发者ID:dfr0,项目名称:moon,代码行数:10,代码来源:StrokeTest.cs

示例5: Graph

 public Graph(IDelegate _del, Stroke b)
 {
     del = _del;
     box = b;
     bounds = box.GetBounds();
     box.StylusPoints = InkUtils.xkcd(InkUtils.box(bounds));
     box.DrawingAttributes.Color = Colors.Blue;
     analyzer = new InkAnalyzer();
     analyzer.ContextNodeCreated += ContextNodeCreated;
 }
开发者ID:rudi-c,项目名称:htn-stylus,代码行数:10,代码来源:GraphAnalyzer.cs

示例6: Stroke_Default

		public void Stroke_Default ()
		{
			Stroke s = new Stroke ();

			Assert.AreEqual (0, s.StylusPoints.Count, "StylusPoints");

			Assert.Throws<ArgumentException> (delegate {
				s.HitTest (null);
			}, "HitTest-null");
			Assert.IsFalse (s.HitTest (s.StylusPoints), "HitTest-StylusPoints");
		}
开发者ID:dfr0,项目名称:moon,代码行数:11,代码来源:StrokeTest.cs

示例7: ipMouseLeftButtonDown

        public void ipMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            myInkPresenter.CaptureMouse();

            _stroke = new Stroke(e.StylusDevice.GetStylusPoints(myInkPresenter))
                      	{
                      		DrawingAttributes = {Color = Colors.Blue,
                            OutlineColor = Colors.White},
                      	};

            myInkPresenter.Strokes.Add(_stroke);
        }
开发者ID:stiano,项目名称:sl4,代码行数:12,代码来源:Login.xaml.cs

示例8: myInkPresenter_MouseLeftButtonDown

 private void myInkPresenter_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     //捕获鼠标焦点
     myInkPresenter.CaptureMouse();
     myPointCollection = new StylusPointCollection();
     myPointCollection.Add(e.StylusDevice.GetStylusPoints(myInkPresenter));
     currentStroke = new Stroke(myPointCollection);
     //设置画笔属性
     currentStroke.DrawingAttributes.Color = currentColor;
     currentStroke.DrawingAttributes.Height = sliderThickness.Value;
     currentStroke.DrawingAttributes.Width = sliderThickness.Value;
     myInkPresenter.Strokes.Add(currentStroke);
 }
开发者ID:Tek-Eternal,项目名称:MyInkPresenter,代码行数:13,代码来源:MainPage.xaml.cs

示例9: annotoPenReceiver_PenUp

        void annotoPenReceiver_PenUp(object sender, AnnotoPenMotionEventArgs e)
        {
            Dispatcher.BeginInvoke((Action)delegate()
            {
                /*if (currentPts == null || currentPts.Count == 0)
                {
                    return;
                }

                inkCanvas.Strokes.Add(new Stroke(currentPts));
                currentPts = new StylusPointCollection();*/
                currentStroke = null;
                Trace.WriteLine("Pen Up");
            }, null);
        }
开发者ID:zhuangfangwang,项目名称:ise,代码行数:15,代码来源:AnnotoPenViewer.xaml.cs

示例10: StrokeToString

 private string StrokeToString(Stroke stroke)
 {
     var strokestring = "<stroke>";
     strokestring += "<color>" + stroke.DrawingAttributes.Color.ToString() + "</color>";
     strokestring += "<size>" + stroke.DrawingAttributes.Height.ToString() + "</size>";
     strokestring += "<creator>" + me + "</creator>";
     strokestring += "<points>";
     foreach (StylusPoint sp in stroke.StylusPoints)
     {
         strokestring += sp.X + "," + sp.Y + "," + sp.PressureFactor + " ";
     }
     strokestring.TrimEnd(new char[] { ' ' });
     strokestring += "</points>";
     strokestring += "</stroke>";
     return strokestring;
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:16,代码来源:MainPage.xaml.cs

示例11: GetIterator

        /// <summary>
        /// Helper wrapper
        /// </summary>
        internal static StrokeNodeIterator GetIterator(Stroke stroke, DrawingAttributes drawingAttributes)
        {
            if (stroke == null)
            {
                throw new System.ArgumentNullException("stroke");
            }
            if (drawingAttributes == null)
            {
                throw new System.ArgumentNullException("drawingAttributes");
            }

            StylusPointCollection stylusPoints =
                drawingAttributes.FitToCurve ? stroke.GetBezierStylusPoints() : stroke.StylusPoints;

            return GetIterator(stylusPoints, drawingAttributes);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:19,代码来源:StrokeNodeEnumerator.cs

示例12: process

 public void process(InkAnalyzer inkAnalyzer)
 {
     ContextNodeCollection nodeCollection = inkAnalyzer.FindLeafNodes();
     foreach (ContextNode childNodes in nodeCollection)
     {
         foreach (Stroke stroke in childNodes.Strokes)
         {
             if (strokeIsCaret(stroke))
             {
                 insertionBox.Visibility = Visibility.Visible;
                 Canvas.SetLeft(insertionBox, stroke.StylusPoints[0].X - 140);
                 Canvas.SetTop(insertionBox, stroke.StylusPoints[1].Y);
                 inkAnalyzer.RemoveStroke(stroke);
                 strokeToBeReplaced = stroke;
             }
         }
     }
 }
开发者ID:rudi-c,项目名称:htn-stylus,代码行数:18,代码来源:InsertionProcessor.cs

示例13: Update

        protected void Update( object sender, EventArgs e )
        {
            paintCanvas.Strokes.Clear();
            windowWidth = (float)this.Width;
            windowHeight = (float)this.Height;

            Leap.Frame frame = leap.Frame();
            InteractionBox interactionBox = leap.Frame().InteractionBox;

            foreach ( Pointable pointable in leap.Frame().Pointables ) {
                // ここから追加
                // 伸びている指、ツール以外は無視する
                //if ( !pointable.IsExtended ) {
                //    continue;
                //}
                // ここまで追加

                Leap.Vector normalizedPosition =
                    interactionBox.NormalizePoint( pointable.StabilizedTipPosition );
                float tx = normalizedPosition.x * windowWidth;
                float ty = windowHeight - normalizedPosition.y * windowHeight;

                int alpha = 255;
                if ( (pointable.TouchDistance > 0 && pointable.TouchZone != Pointable.Zone.ZONENONE ) ) {
                    alpha = 255 - (int)(255 * pointable.TouchDistance);
                    touchIndicator.Color = Color.FromArgb( (byte)alpha, 0x0, 0xff, 0x0 );
                }
                else if ( pointable.TouchDistance <= 0 ) {
                    alpha = -(int)(255 * pointable.TouchDistance);
                    touchIndicator.Color = Color.FromArgb( (byte)alpha, 0xff, 0x0, 0x0 );
                }
                else {
                    alpha = 50;
                    touchIndicator.Color = Color.FromArgb( (byte)alpha, 0x0, 0x0, 0xff );
                }

                StylusPoint touchPoint = new StylusPoint( tx, ty );
                StylusPointCollection tips =
                    new StylusPointCollection( new StylusPoint[] { touchPoint } );
                Stroke touchStroke = new Stroke( tips, touchIndicator );
                paintCanvas.Strokes.Add( touchStroke );
            }
        }
开发者ID:kaorun55,项目名称:LeapMotionIntroduction2,代码行数:43,代码来源:MainWindow.xaml.cs

示例14: Stroke_StylusPointCollection

		public void Stroke_StylusPointCollection ()
		{
			StylusPointCollection spc = new StylusPointCollection ();
			spc.Add (new StylusPoint (1, 2));

			Stroke s = new Stroke (spc);
			Assert.AreEqual (1, s.StylusPoints.Count, "StylusPoints-1");

			spc.Add (new StylusPoint (3, 4));
			Assert.AreEqual (2, s.StylusPoints.Count, "StylusPoints-2");

			s.StylusPoints.Add (new StylusPoint (5, 6));
			Assert.AreEqual (3, s.StylusPoints.Count, "StylusPoints-3a");
			Assert.AreEqual (3, spc.Count, "StylusPoints-3b");

			Assert.Throws<ArgumentException> (delegate {
				s.HitTest (null);
			}, "HitTest-null");
			Assert.IsTrue (s.HitTest (s.StylusPoints), "HitTest-StylusPoints");
		}
开发者ID:dfr0,项目名称:moon,代码行数:20,代码来源:StrokeTest.cs

示例15: StrokeVisual

            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="stroke">a stroke to render into this visual</param>
            /// <param name="renderer">a renderer associated to this visual</param>
            internal StrokeVisual(Stroke stroke, Renderer renderer) : base()
            {
                Debug.Assert(renderer != null);

                if (stroke == null)
                {
                    throw new System.ArgumentNullException("stroke");
                }

                _stroke = stroke;
                _renderer = renderer;

                // The original value of the color and IsHighlighter are cached so
                // when Stroke.Invalidated is fired, Renderer knows whether re-arranging
                // the visual tree is needed.
                _cachedColor = stroke.DrawingAttributes.Color;
                _cachedIsHighlighter = stroke.DrawingAttributes.IsHighlighter;

                // Update the visual contents
                Update();
            }
开发者ID:JianwenSun,项目名称:cc,代码行数:26,代码来源:Renderer.cs


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