Ejemplo n.º 1
0
        public static ClickResult ClickHandler(System.Drawing.Point pt, MouseButtons but, ref Curve curElement)
        {
            //MessageBox.Show("Circle");


            if (but == MouseButtons.Right)
            {
                return(ClickResult.canceled);
            }


            else if (but == MouseButtons.Left)


            {
                var center = new Point(pt.X, pt.Y);

                if (curElement == null || curElement.GetType() != typeof(Circle)) // prüft ob es nur Circle ist
                {
                    curElement = new Circle(center, 0);


                    return(ClickResult.created);
                }


                else
                {
                    var endPoint = new Point(pt.X, pt.Y);

                    Circle circle = curElement as Circle;
                    double r      = circle.CenterPoint.DistanceTo(endPoint);
                    //Line l2 = new Line(circle.CenterPoint.X, circle.CenterPoint.Y, endPoint.X, endPoint.Y);
                    circle.Radius = r;



                    return(ClickResult.finished);
                }
            }

            return(ClickResult.canceled);
        }
Ejemplo n.º 2
0
        public static ClickResult ClickHandler(System.Drawing.Point pt, MouseButtons but, ref Curve curElement)
        {
            if (but == MouseButtons.Right)
            {
                return(ClickResult.canceled);
            }


            else if (but == MouseButtons.Left)


            {
                //var startPoint = new Point();


                if (curElement == null || curElement.GetType() != typeof(Line)) // prüft ob es nur linie ist
                {
                    var endpoint = new Point();

                    Line line1 = new Line(pt.X, pt.Y, pt.X, pt.Y);
                    curElement = line1;


                    return(ClickResult.created);
                }


                else
                {
                    (curElement as Line).EndPoint = new Point(pt.X, pt.Y);

                    return(ClickResult.finished);
                }
            }

            return(ClickResult.canceled);
        }
Ejemplo n.º 3
0
        public static ClickResult ClickHandler(System.Drawing.Point pt, MouseButtons but, ref Curve curElement)
        {
            if (curElement == null)
            {
                return(ClickResult.canceled);
            }

            if (curElement.GetType() != typeof(Circle) && but == MouseButtons.Left) // prüft ob es nur linie ist
            {
                var point = new Point(pt.X, pt.Y);

                Points.Add(point);
                Polyline pl = new Polyline(Points);
                curElement = new Polyline(Points);
                return(ClickResult.created);
            }
            else
            {
                Polyline poly = curElement as Polyline;
                if (but == MouseButtons.Left)
                {
                    var point2 = new Point(pt.X, pt.Y);
                    poly.AddPoint(point2);

                    return(ClickResult.pointHandled);
                }
                else if (Points.Count < 2 && but == MouseButtons.Right)
                {
                    return(ClickResult.canceled);
                }
                else
                {
                    return(ClickResult.finished);
                }
            }
        }
Ejemplo n.º 4
0
 public Point TransformScreen2World(System.Drawing.Point screenPoint)
 {
     return(new Point(screenPoint.X, -(screenPoint.Y - 5)));
 }
Ejemplo n.º 5
0
 public Point TransformScreen2World(System.Drawing.Point screenPoint)
 {
     return(new Point(screenPoint.X, -(screenPoint.Y - pictureBox1.Height)));
 }