예제 #1
0
        public override object Clone()
        {
            DDRectangle ret = new DDRectangle();

            CloneTo(ret);
            ret.CornerRadiusX = CornerRadiusX;
            ret.CornerRadiusY = CornerRadiusY;
            return(ret);
        }
예제 #2
0
        public static DDObject TryCreateFromCLR(object clrSource)
        {
            if (!(clrSource is Shape))
            {
                return(null);
            }

            DDObject newObject = null;

            if (clrSource is Path)
            {
                if (((clrSource as Path).Data is PathGeometry) &&
                    (((clrSource as Path).Data as PathGeometry).Figures.Count > 0))
                {
                    if (((clrSource as Path).Data as PathGeometry).Figures[0].IsFilled)
                    {
                        newObject = new DDPolygon();
                    }
                    else
                    {
                        newObject = new DDPolyline();
                    }
                }
            }
            if (clrSource is Rectangle)
            {
                newObject = new DDRectangle();
            }
            if (clrSource is Ellipse)
            {
                newObject = new DDEllipse();
            }

            if (newObject != null)
            {
                if (newObject.SetFromCLR(clrSource as Shape))
                {
                    return(newObject);
                }
            }

            return(null);
        }