Exemplo n.º 1
0
        public PropertiesGraphicsRectangle(GraphicsRectangle rectangle)
        {
            if (rectangle == null)
            {
                throw new ArgumentNullException("rectangle");
            }

            left   = rectangle.Left;
            top    = rectangle.Top;
            right  = rectangle.Right;
            bottom = rectangle.Bottom;

            lineWidth   = rectangle.LineWidth;
            objectColor = rectangle.ObjectColor;
            actualScale = rectangle.ActualScale;
            ID          = rectangle.Id;
            selected    = rectangle.IsSelected;
        }
Exemplo n.º 2
0
        public override GraphicsBase CreateGraphics()
        {
            GraphicsBase b = new GraphicsRectangle(left, top, right, bottom, lineWidth, objectColor, actualScale);

            // GraphicsBase contains new ID generated by constructor.
            // This is OK if this instance is loaded from XML file.
            // But if this instance is part of commands history,
            // it contains ID which should be set in GraphicsBase.
            // This rule is applied to all SerializedGraphicsBase-derived
            // classes.

            if (this.ID != 0)       // from command history, not from file
            {
                b.Id         = this.ID;
                b.IsSelected = this.selected;
            }

            return(b);
        }