예제 #1
0
 public static void DrawDiamond(this Graphics g, Pen pen, Rectangle rect)
 {
     using (GraphicsPath gp = new GraphicsPath())
     {
         gp.AddDiamond(rect);
         g.DrawPath(pen, gp);
     }
 }
 protected override void AddShapePath(GraphicsPath graphicsPath, Rectangle rect)
 {
     graphicsPath.AddDiamond(rect);
 }
예제 #3
0
        protected virtual void AddShapePath(GraphicsPath graphicsPath, RegionInfo regionInfo, int sizeOffset = 0)
        {
            Rectangle area = regionInfo.Area.SizeOffset(sizeOffset);

            switch (regionInfo.Shape)
            {
                default:
                case RegionShape.Rectangle:
                    graphicsPath.AddRectangle(area);
                    break;
                case RegionShape.RoundedRectangle:
                    graphicsPath.AddRoundedRectangle(area, regionInfo.RoundedRectangleRadius);
                    break;
                case RegionShape.Ellipse:
                    graphicsPath.AddEllipse(area);
                    break;
                case RegionShape.Triangle:
                    graphicsPath.AddTriangle(area, regionInfo.TriangleAngle);
                    break;
                case RegionShape.Diamond:
                    graphicsPath.AddDiamond(area);
                    break;
            }
        }