GetRoundPath() public static method

public static GetRoundPath ( Rectangle r, int depth ) : GraphicsPath
r System.Drawing.Rectangle
depth int
return System.Drawing.Drawing2D.GraphicsPath
Beispiel #1
0
        private void drawClickStateBackground(System.Windows.Forms.PaintEventArgs e,
                                              LinearGradientMode mode,
                                              int tmpSoundCornerRadius,
                                              int tmpShadowOffSet
                                              )
        {
            Pen          pen       = new Pen(BackColor);
            Rectangle    newRect   = new Rectangle(ClientRectangle.X + tmpShadowOffSet / 2, ClientRectangle.Y + tmpShadowOffSet / 2, ClientRectangle.Width - tmpShadowOffSet, ClientRectangle.Height - tmpShadowOffSet);
            GraphicsPath graphPath = AWBGraphicsPath.GetRoundPath(newRect, tmpSoundCornerRadius);

            e.Graphics.DrawRectangle(pen, newRect);
            drawBackground(e, _HoverBorderColor, _HoverColorA, _HoverColorB, ref newRect, graphPath);
            pen.Dispose();
        }
Beispiel #2
0
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);
            LinearGradientMode mode;
            int          tmpShadowOffSet      = Math.Min(Math.Min(_shadowOffSet, base.Width - 2), base.Height - 2);
            int          tmpSoundCornerRadius = Math.Min(Math.Min(_roundCornerRadius, base.Width - 2), base.Height - 2);
            Rectangle    rect            = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - tmpShadowOffSet - 1, ClientRectangle.Height - tmpShadowOffSet - 1);
            Rectangle    rectShadow      = new Rectangle(tmpShadowOffSet, tmpShadowOffSet, ClientRectangle.Width - tmpShadowOffSet - 1, ClientRectangle.Height - tmpShadowOffSet - 1);
            GraphicsPath graphPathShadow = AWBGraphicsPath.GetRoundPath(rectShadow, tmpSoundCornerRadius);
            GraphicsPath graphPath       = AWBGraphicsPath.GetRoundPath(rect, tmpSoundCornerRadius);


            //
            // set SmoothingMode
            //
            getSmoothingQuality(e);

            //
            // set LinearGradientMode
            //
            mode = getGradientMode();
            if (_Active)
            {
                switch (_State)
                {
                case _States.Normal:
                    drawNormalStateBacground(e, mode, ref rect, tmpSoundCornerRadius, graphPathShadow, graphPath);
                    break;

                case _States.MouseOver:
                    drawHoverStateBackground(e, mode, ref rect, tmpSoundCornerRadius, graphPathShadow, graphPath);
                    break;

                case _States.Clicked:
                    drawClickStateBackground(e, mode, tmpSoundCornerRadius, tmpShadowOffSet);
                    break;
                }
            }
            else
            {
                drawInactiveStateBackground(e, mode, ref rect, tmpSoundCornerRadius, graphPathShadow, graphPath);
            }
        }