예제 #1
0
        /// <summary>
        /// Create a graphics path to draw the entity shape.
        /// </summary>
        protected GraphicsPath CreateShape(Size sz)
        {
            var roundSize = Math.Min(sz.Width, sz.Height) / 2;

            switch (Entity.Shape)
            {
            case Shapes.Circle:
                return(GraphicsUtil.CreateRoundedRectangle(sz, roundSize));

            case Shapes.Diamond:
                return(GraphicsUtil.CreateDiamond(sz));

            case Shapes.Square:
                return(GraphicsUtil.CreateSquare(sz));

            case Shapes.Triangle:
                return(GraphicsUtil.CreateTriangle(sz));

            default:
                throw new ArgumentException("Unknown shape: " + (int)Entity.Shape);
            }
        }