public static void DrawSquareShadow(Graphics g, Rectangle bounds) { using (SolidBrush shadowBrush = new SolidBrush(Color.FromArgb(12, 0, 0, 0))) { GraphicsPath path; path = DrawHelper.CreateRoundRect(new RectangleF(bounds.X - 3.5f, bounds.Y - 1.5f, bounds.Width + 6, bounds.Height + 6), 8); g.FillPath(shadowBrush, path); path = DrawHelper.CreateRoundRect(new RectangleF(bounds.X - 2.5f, bounds.Y - 1.5f, bounds.Width + 4, bounds.Height + 4), 6); g.FillPath(shadowBrush, path); path = DrawHelper.CreateRoundRect(new RectangleF(bounds.X - 1.5f, bounds.Y - 0.5f, bounds.Width + 2, bounds.Height + 2), 4); g.FillPath(shadowBrush, path); path = DrawHelper.CreateRoundRect(new RectangleF(bounds.X - 0.5f, bounds.Y + 1.5f, bounds.Width + 0, bounds.Height + 0), 4); g.FillPath(shadowBrush, path); path = DrawHelper.CreateRoundRect(new RectangleF(bounds.X - 0.5f, bounds.Y + 2.5f, bounds.Width + 0, bounds.Height + 0), 4); g.FillPath(shadowBrush, path); path.Dispose(); } }
public static GraphicsPath CreateRoundRect(Rectangle rect, float radius) { return(DrawHelper.CreateRoundRect((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height, radius)); }