System.Drawing.Drawing2D.GraphicsPath.AddEllipse C# (CSharp) Method

AddEllipse() public method

public AddEllipse ( Rectangle rect ) : void
rect Rectangle
return void
        public void AddEllipse(Rectangle rect)
        {
            AddEllipse (new RectangleF (rect.X, rect.Y, rect.Width, rect.Height));
        }

Same methods

GraphicsPath::AddEllipse ( RectangleF rect ) : void
GraphicsPath::AddEllipse ( float x, float y, float width, float height ) : void
GraphicsPath::AddEllipse ( int x, int y, int width, int height ) : void

Usage Example

Exemplo n.º 1
1
        public static void RenderEllipseGlass(Graphics g, Rectangle ownerRect, GlassPosition position,
            float positionFactor, Color glassColor, int alphaCenter, int alphaSurround)
        {
            if (!(positionFactor > 0 && positionFactor < 1))
                throw new ArgumentException("positionFactor must be between 0 and 1, but not include 0 and 1. ",
                    "positionFactor");

            ownerRect.Height--;
            ownerRect.Width--;

            if (ownerRect.Width < 1 || ownerRect.Height < 1)
                return;

            using (GraphicsPath gp = new GraphicsPath())
            {
                gp.AddEllipse(ownerRect);
                using (PathGradientBrush pb = new PathGradientBrush(gp))
                {
                    pb.CenterPoint = GetEllipseGlassCenterPoint(ownerRect, position, positionFactor);
                    pb.CenterColor = Color.FromArgb(alphaCenter, glassColor);
                    pb.SurroundColors = new Color[] { Color.FromArgb(alphaSurround, glassColor) };
                    using (NewSmoothModeGraphics ng = new NewSmoothModeGraphics(g, SmoothingMode.AntiAlias))
                    {
                        g.FillPath(pb, gp);
                    }
                }
            }
        }
All Usage Examples Of System.Drawing.Drawing2D.GraphicsPath::AddEllipse