public static void RenderRadioButton(Graphics g, Rectangle rect, SmartRadioButtonThemeBase xtheme,
            bool enable, bool selected, SmartButtonState state, string text,
            CheckMarkAlignment markAlign, bool drawFocus)
        {
            Rectangle rectMark, rectText;

            GetCheckRectAndTextRect(
                rect,
                xtheme.InnerPaddingWidth,
                xtheme.RadioMarkWidth,
                xtheme.SpaceBetweenMarkAndText,
                markAlign,
                text,
                xtheme.TextFont,
                out rectMark,
                out rectText);

            RadioMarkPainter.RenderRadioMark(
                g,
                rectMark,
                xtheme,
                enable,
                selected,
                state);
            System.Windows.Forms.TextRenderer.DrawText(
                g,
                text,
                xtheme.TextFont,
                rectText,
                enable ? xtheme.TextColor : xtheme.TextColorDisabled,
                TextFormatFlags.Left | TextFormatFlags.VerticalCenter);
            if (drawFocus)
                BasicBlockPainter.RenderFocusRect(g, rectText, 0);

            //rectMark.Width--;
            //rectMark.Height--;
            //g.DrawRectangle(Pens.Red, rectMark);

            //rectText.Width--;
            //rectText.Height--;
            //g.DrawRectangle(Pens.Blue, rectText);

            //rect.Width--;
            //rect.Height--;
            //g.DrawRectangle(Pens.Black, rect);
        }
        public static void RenderRadioMark(Graphics g, Rectangle rect,
            SmartRadioButtonThemeBase xtheme, bool enable, bool selected, SmartButtonState state)
        {
            if (rect.Width < 1 || rect.Height < 1)
                return;

            // get back-color
            Color backColor;
            if (!enable)
            {
                backColor = xtheme.RadioMarkBackColorDisabled;
            }
            else
            {
                switch (state)
                {
                    case SmartButtonState.Hover:
                        backColor = xtheme.RadioMarkBackColorHighLight;
                        break;
                    case SmartButtonState.Pressed:
                        backColor = xtheme.RadioMarkBackColorPressed;
                        break;
                    default:
                        backColor = xtheme.RadioMarkBackColorNormal;
                        break;
                }
            }

            // get outter-circle-color
            Color circleColor = enable ? xtheme.OutterCircleColor : xtheme.OutterCircleColorDisabled;

            // get inner-spot-color
            Color innerColor = enable ? xtheme.InnerSpotColor : xtheme.InnerSpotColorDisabled;

            using (NewSmoothModeGraphics ng = new NewSmoothModeGraphics(g, SmoothingMode.AntiAlias))
            {
                // draw background
                Rectangle r1 = rect;
                r1.Width--;
                r1.Height--;
                if (r1.Width > 0 && r1.Height > 0)
                {
                    using (SolidBrush sb = new SolidBrush(backColor))
                    {
                        g.FillEllipse(sb, r1);
                    }
                }

                // draw outter circle
                using (Pen p = new Pen(circleColor))
                {
                    g.DrawEllipse(p, rect);
                }

                // draw high-light-outter-circle
                if (xtheme.HighLightOutterCircle && state == SmartButtonState.Hover)
                {
                    using (Pen p = new Pen(Color.FromArgb(xtheme.OutterCircleHighLightAlpha, circleColor)))
                    {
                        p.Width = 3;
                        p.Alignment = PenAlignment.Center;
                        g.DrawEllipse(p, rect);
                    }
                }

                // draw inner spot
                if (selected)
                {
                    rect.Inflate(-xtheme.InnerSpotInflate, -xtheme.InnerSpotInflate);
                    using (SolidBrush sb = new SolidBrush(innerColor))
                    {
                        g.FillEllipse(sb, rect);
                    }

                    // draw glass on inner spot
                    if (xtheme.ShowGlassOnInnerSpot)
                    {
                        GlassPainter.RenderEllipseGlass(g, rect, GlassPosition.Top, 0.2f, Color.White, 160, 20);
                    }
                }
            }
        }
 public void SetNewTheme(SmartRadioButtonThemeBase xtheme)
 {
     if (xtheme == null)
         throw new ArgumentNullException("xtheme");
     _xtheme = xtheme;
     base.Invalidate();
 }