Exemple #1
0
            protected virtual NDrawingDataObject AdaptMyCustomFormat(NMyDataObject myDataObject)
            {
                if (myDataObject == null)
                {
                    throw new ArgumentNullException("myDataObject");
                }

                // create the respective shape with the specified size
                NShape shape;

                if (myDataObject.shapeType == "Rectangle")
                {
                    shape = new NRectangleShape(new NPointF(0, 0), myDataObject.shapeSize);
                }
                else if (myDataObject.shapeType == "Ellipse")
                {
                    shape = new NEllipseShape(new NPointF(0, 0), myDataObject.shapeSize);
                }
                else
                {
                    return(null);
                }

                // create a drawing data object, which encapsulates the shape
                NDrawingDataObject ddo = new NDrawingDataObject(null, new INDiagramElement[] { shape });

                return(ddo);
            }
Exemple #2
0
            protected virtual NDrawingDataObject AdaptBitmap(Bitmap bmp)
            {
                if (bmp == null)
                {
                    throw new ArgumentNullException("bmp");
                }

                // create a rectangle shape with the proper dimensions
                // and fill it with the bitmap
                NRectangleShape shape = new NRectangleShape(0, 0, bmp.Width, bmp.Height);

                shape.Style.FillStyle = new NImageFillStyle(bmp);

                // create a drawing data object, which encapsulates the shape
                NDrawingDataObject ddo = new NDrawingDataObject(null, new INDiagramElement[] { shape });

                return(ddo);
            }