/// <summary>
        /// Pills the specified rectangle.
        /// </summary>
        /// <param name="Rectangle">The rectangle.</param>
        /// <param name="PillStyle">The pill style.</param>
        /// <returns>GraphicsPath.</returns>
        public static GraphicsPath Pill(Rectangle Rectangle, PillStyle PillStyle)
        {
            GraphicsPath functionReturnValue = default(GraphicsPath);

            functionReturnValue = new GraphicsPath();

            if (PillStyle.Left)
            {
                functionReturnValue.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, Rectangle.Height, Rectangle.Height), -270, 180);
            }
            else
            {
                functionReturnValue.AddLine(Rectangle.X, Rectangle.Y + Rectangle.Height, Rectangle.X, Rectangle.Y);
            }

            if (PillStyle.Right)
            {
                functionReturnValue.AddArc(new Rectangle(Rectangle.X + Rectangle.Width - Rectangle.Height, Rectangle.Y, Rectangle.Height, Rectangle.Height), -90, 180);
            }
            else
            {
                functionReturnValue.AddLine(Rectangle.X + Rectangle.Width, Rectangle.Y, Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height);
            }

            functionReturnValue.CloseAllFigures();

            return(functionReturnValue);

            return(functionReturnValue);
        }
        public static GraphicsPath Pill(Rectangle Rectangle, PillStyle PillStyle)
        {
            GraphicsPath tempPill = null;

            tempPill = new GraphicsPath();

            if (PillStyle.Left)
            {
                tempPill.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, Rectangle.Height, Rectangle.Height), -270F, 180F);
            }
            else
            {
                tempPill.AddLine(Rectangle.X, Rectangle.Y + Rectangle.Height, Rectangle.X, Rectangle.Y);
            }

            if (PillStyle.Right)
            {
                tempPill.AddArc(new Rectangle(Rectangle.X + Rectangle.Width - Rectangle.Height, Rectangle.Y, Rectangle.Height, Rectangle.Height), -90F, 180F);
            }
            else
            {
                tempPill.AddLine(Rectangle.X + Rectangle.Width, Rectangle.Y, Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height);
            }

            tempPill.CloseAllFigures();

            return(tempPill);
        }
 /// <summary>
 /// Pills the specified x.
 /// </summary>
 /// <param name="X">The x.</param>
 /// <param name="Y">The y.</param>
 /// <param name="Width">The width.</param>
 /// <param name="Height">The height.</param>
 /// <param name="PillStyle">The pill style.</param>
 /// <returns>System.Object.</returns>
 public static object Pill(int X, int Y, int Width, int Height, PillStyle PillStyle)
 {
     return(Pill(new Rectangle(X, Y, Width, Height), PillStyle));
 }
        void DrawPill(Graphics G, Pen P, Brush B, Brush B2, float x, float y, float width, float height, float fill, PillStyle style)
        {
            float H = height - width;

            float radius = width / 2.0f;

            switch (style)
            {
            case PillStyle.Bipolar:
            {
                if (fill > 0)
                {
                    var FPath = new System.Drawing.Drawing2D.GraphicsPath();
                    // FPath.AddArc(x, y, width, width, 180, 180);

                    FPath.AddLine(x + width, y + radius + 0.5f * (height - width), x + width, y + radius + (height - width - radius) * (fill * 0.5f + 0.5f));
                    //  if (fill >= 0.9)
                    // {
                    FPath.AddArc(x, y + radius + (height - width - radius) * (fill * 0.5f + 0.5f), width, width, 0, 180);
                    // }
                    FPath.AddLine(x, y + radius + (height - width - radius) * (fill * 0.5f + 0.5f), x, y + radius + 0.5f * (height - width));

                    //G.FillPath(B, FPath);
                    //x -= 50.0f;
                    G.FillPath(B, FPath);
                }
                else
                {
                    fill = 1 + fill;
                    var FPath = new System.Drawing.Drawing2D.GraphicsPath();

                    FPath.AddArc(x, y + (fill * 0.5f) * (height - width), width, width, 180, 180);
                    FPath.AddLine(x + width, y + (fill * 0.5f + 0.5f) * (height - width), x + width, y + radius + (height - width) * 0.5f);
                    FPath.AddLine(x, y + radius + 0.5f * (height - width), x, y + radius + (height - width) * (fill * 0.5f + 0.5f));


                    G.FillPath(B2, FPath);
                }
            }
            break;

            case PillStyle.Positive:
                break;

            case PillStyle.Negative:
                break;
            }


            var Path = new System.Drawing.Drawing2D.GraphicsPath();

            Path.AddArc(x, y, width, width, 180, 180);

            Path.AddLine(x + width, y + radius, x + width, y + height - radius);
            Path.AddArc(x, y + H, width, width, 0, 180);
            Path.AddLine(x, y + height - radius, x, y + radius);

            G.DrawPath(P, Path);
        }