Esempio n. 1
0
        public bool IsSelectShape(ShapePoint e)
        {
            bool isSelect = false;

            for (int i = 0; i < _storage.GetCount(); i++)
            {
                var tmp = _storage.GetShapeForIndex(i);

                if (tmp.Name == EShapeType.Dot && !isSelect)
                {
                    if ((e.X >= tmp.Location.X - tmp.Thickness / 2 && e.X <= tmp.Location.X + tmp.Thickness))
                    {
                        if ((e.Y >= tmp.Location.Y - tmp.Thickness / 2 && e.Y <= tmp.Location.Y + tmp.Thickness))
                        {
                            isSelect = true;
                            Numb     = i;
                        }
                        else
                        {
                            isSelect = false;
                        }
                    }
                }
                if (tmp.Location != null && tmp.FinishLocation != null)
                {
                    if (((e.X < tmp.FinishLocation.X) && (e.X > tmp.Location.X)) && tmp.Name != EShapeType.Dot && !isSelect || ((e.X > tmp.FinishLocation.X) && (e.X < tmp.Location.X) && tmp.Name != EShapeType.Dot && !isSelect))
                    {
                        if (((e.Y < tmp.FinishLocation.Y) && (e.Y > tmp.Location.Y)) || ((e.Y > tmp.FinishLocation.Y) && (e.Y < tmp.Location.Y)))
                        {
                            isSelect = true;
                            Numb     = i;
                        }
                        else
                        {
                            isSelect = false;
                        }
                    }
                }
            }

            return(isSelect);
        }
Esempio n. 2
0
        public void Move(int dx, int dy, IShape shape)
        {
            int startX = shape.Location.X + dx;
            int startY = shape.Location.Y + dy;

            if (shape.FinishLocation != null)
            {
                int finX = shape.FinishLocation.X + dx;
                int finY = shape.FinishLocation.Y + dy;

                ShapePoint finish = new ShapePoint(finX, finY);
                shape.FinishLocation = finish;
            }
            else
            {
                shape.FinishLocation = null;
            }

            ShapePoint start = new ShapePoint(startX, startY);


            shape.Location = start;
        }
Esempio n. 3
0
 public PaintRectangle(ShapePoint location, ShapeSize size)
 {
     _rectangle.Location = location.ToPoint();
     _rectangle.Size     = size.ToSize();
 }
Esempio n. 4
0
 public void DrawLine(PaintPen pen, ShapePoint pt1, ShapePoint pt2)
 {
     _graphics.DrawLine(pen.ToPen(), pt1.ToPoint(), pt2.ToPoint());
 }