/// <summary> /// Converts the specified RadioButtonStates value to a ButtonState value /// </summary> /// <param name="state">The RadioButtonStates value to be converted</param> /// <returns>A ButtonState value that represents the specified RadioButtonStates /// value</returns> private static ButtonState ConvertRadioButtonStateToButtonState(RadioButtonStates state) { switch (state) { case RadioButtonStates.UncheckedPressed: { return ButtonState.Pushed; } case RadioButtonStates.UncheckedDisabled: { return ButtonState.Inactive; } case RadioButtonStates.CheckedNormal: case RadioButtonStates.CheckedHot: { return ButtonState.Checked; } case RadioButtonStates.CheckedPressed: { return (ButtonState.Checked | ButtonState.Pushed); } case RadioButtonStates.CheckedDisabled: { return (ButtonState.Checked | ButtonState.Inactive); } } return ButtonState.Normal; }
/// <summary> /// Draws a RadioButton in the specified state, on the specified graphics /// surface, and within the specified bounds /// </summary> /// <param name="g">The Graphics to draw on</param> /// <param name="checkRect">The Rectangle that represents the dimensions /// of the RadioButton</param> /// <param name="clipRect">The Rectangle that represents the clipping area</param> /// <param name="state">A RadioButtonStates value that specifies the /// state to draw the RadioButton in</param> public static void DrawRadioButton(Graphics g, Rectangle checkRect, Rectangle clipRect, RadioButtonStates state) { if (g == null || checkRect.Width <= 0 || checkRect.Height <= 0) { return; } if (ThemeManager.VisualStylesEnabled) { ThemeManager.DrawThemeBackground(g, ThemeClasses.Button, (int) ButtonParts.RadioButton, (int) state, checkRect, clipRect); } else { ControlPaint.DrawRadioButton(g, checkRect, ThemeManager.ConvertRadioButtonStateToButtonState(state)); } }
/// <summary> /// Draws a RadioButton in the specified state, on the specified graphics /// surface, and within the specified bounds /// </summary> /// <param name="g">The Graphics to draw on</param> /// <param name="checkRect">The Rectangle that represents the dimensions /// of the RadioButton</param> /// <param name="state">A RadioButtonStates value that specifies the /// state to draw the RadioButton in</param> public static void DrawRadioButton(Graphics g, Rectangle checkRect, RadioButtonStates state) { ThemeManager.DrawRadioButton(g, checkRect, checkRect, state); }
/// <summary> /// Draws a RadioButton in the specified state, on the specified graphics /// surface, and within the specified bounds /// </summary> /// <param name="g">The Graphics to draw on</param> /// <param name="checkRect">The Rectangle that represents the dimensions /// of the RadioButton</param> /// <param name="clipRect">The Rectangle that represents the clipping area</param> /// <param name="state">A RadioButtonStates value that specifies the /// state to draw the RadioButton in</param> public static void DrawRadioButton(Graphics g, Rectangle checkRect, Rectangle clipRect, RadioButtonStates state) { if (g == null || checkRect.Width <= 0 || checkRect.Height <= 0) { return; } if (ThemeManager.VisualStylesEnabled) { ThemeManager.DrawThemeBackground(g, ThemeClasses.Button, (int)ButtonParts.RadioButton, (int)state, checkRect, clipRect); } else { ControlPaint.DrawRadioButton(g, checkRect, ThemeManager.ConvertRadioButtonStateToButtonState(state)); } }