コード例 #1
0
 //Drawing
 public override void Draw(CGRect rect)
 {
     if (CurrentPathView != null)
     {
         CurrentPathView.Stroke();
     }
 }
コード例 #2
0
        public override void TouchesMoved(NSSet touches, UIEvent evt)
        {
            base.TouchesMoved(touches, evt);

            var loc = (touches.AnyObject as UITouch).LocationInView(this);

            CurrentPathView.AddLineTo(loc);
            CurrentStroke.Points.Add(new Point(loc.X, loc.Y));

            SetNeedsDisplay();
        }
コード例 #3
0
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            //System.Diagnostics.Debug.WriteLine("Start touch");

            CurrentStroke = new Stroke()
            {
                StrokeColor = StrokeColor,
                Thickness   = StrokeThickness
            };

            CurrentPathView.CreateNewPath(CurrentStroke);

            var loc = (touches.AnyObject as UITouch).LocationInView(this);

            CurrentPathView.MoveTo(loc);
            CurrentStroke.Points.Add(new Point(loc.X, loc.Y));
        }
コード例 #4
0
        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            if (!Enabled)
            {
                return;
            }

            var loc = (touches.AnyObject as UITouch).LocationInView(this);

            CurrentStroke.Points.Add(new Point(loc.X, loc.Y));
            CurrentPathView.AddLineTo(loc);

            Strokes.Add(CurrentStroke);
            drawPath();

            CurrentPathView.Clear();
            SetNeedsDisplay();
        }
コード例 #5
0
 public void Clear()
 {
     Strokes.Clear();
     CurrentPathView.Clear();
     drawPath();
 }