示例#1
0
 public void AddRange(ShapeCollection shapes)
 {
     foreach (IShape current in shapes)
     {
         base.Add(current);
     }
 }
示例#2
0
        protected HitPositions SelectShape(ShapeCollection shapes, Point point)
        {
            if (Control.ModifierKeys != Keys.Control)
            {
                Select.UnselectAll(shapes);
            }
            HitPositions result;

            for (int i = shapes.Count - 1; i >= 0; i--)
            {
                IShape       shape        = shapes[i];
                HitPositions hitPositions = shape.HitTest(point);
                if (hitPositions != HitPositions.None)
                {
                    if (!shape.Locked)
                    {
                        shapes.BringToFront(shape);
                        shape.Selected            = true;
                        Select._lastSelectedShape = shape;
                    }
                    result = hitPositions;
                    return(result);
                }
            }
            result = HitPositions.None;
            return(result);
        }
示例#3
0
 public static void UnselectAll(ShapeCollection shapes)
 {
     foreach (IShape current in shapes)
     {
         current.Selected = false;
     }
 }
示例#4
0
        public virtual object Clone()
        {
            ShapeCollection shapeCollection = new ShapeCollection();

            foreach (IShape current in this)
            {
                shapeCollection.Add(current.Clone() as IShape);
            }
            return(shapeCollection);
        }
示例#5
0
        public static ShapeCollection GetSelectedShapes(ShapeCollection shapes)
        {
            ShapeCollection shapeCollection = new ShapeCollection();

            foreach (IShape current in shapes)
            {
                if (current.Selected)
                {
                    shapeCollection.Add(current);
                }
            }
            return(shapeCollection);
        }
示例#6
0
 public void SnapToGrid(ShapeCollection shapes)
 {
     foreach (IShape current in shapes)
     {
         bool selected = current.Selected;
         bool locked   = current.Locked;
         current.Selected  = true;
         current.Locked    = false;
         current.Location  = this.GetRoundedPoint(current.Location);
         current.Dimension = this.GetRoundedSize(current.Dimension);
         current.Selected  = selected;
         current.Locked    = locked;
     }
 }
示例#7
0
 public static object[] ToObjects(ShapeCollection shapes)
 {
     object[] result;
     if (shapes.Count == 0)
     {
         result = null;
     }
     else
     {
         object[] array = new object[shapes.Count];
         for (int i = 0; i < shapes.Count; i++)
         {
             array[i] = shapes[i];
         }
         result = array;
     }
     return(result);
 }
示例#8
0
 public virtual bool UpdateCursor(IDocument document, ShapeCollection shapes, Point point)
 {
     return(false);
 }