[ClassInterface (ClassInterfaceType.AutoDispatch)]
[ComVisible (true)]
[DefaultBindingProperty ("Checked")]
- [ToolboxItem ("")]
+ [ToolboxItem ("System.Windows.Forms.Design.AutoSizeToolboxItem," + Consts.AssemblySystem_Design)]
+ [Designer ("System.Windows.Forms.Design.RadioButtonDesigner, " + Consts.AssemblySystem_Design)]
#endif
public class RadioButton : ButtonBase {
#region Local Variables
#region RadioButtonAccessibleObject Subclass
[ComVisible(true)]
+#if NET_2_0
+ public class RadioButtonAccessibleObject : ButtonBaseAccessibleObject {
+#else
public class RadioButtonAccessibleObject : ControlAccessibleObject {
+#endif
#region RadioButtonAccessibleObject Local Variables
private new RadioButton owner;
#endregion // RadioButtonAccessibleObject Local Variables
appearance = Appearance.Normal;
auto_check = true;
radiobutton_alignment = ContentAlignment.MiddleLeft;
- text_alignment = ContentAlignment.MiddleLeft;
+ TextAlign = ContentAlignment.MiddleLeft;
TabStop = false;
}
#endregion // Public Constructors
}
internal override void Draw (PaintEventArgs pe) {
+#if NET_2_0
+ // FIXME: This should be called every time something that can affect it
+ // is changed, not every paint. Can only change so many things at a time.
+
+ // Figure out where our text and image should go
+ Rectangle glyph_rectangle;
+ Rectangle text_rectangle;
+ Rectangle image_rectangle;
+
+ ThemeEngine.Current.CalculateRadioButtonTextAndImageLayout (this, Point.Empty, out glyph_rectangle, out text_rectangle, out image_rectangle);
+
+ // Draw our button
+ if (FlatStyle != FlatStyle.System)
+ ThemeEngine.Current.DrawRadioButton (pe.Graphics, this, glyph_rectangle, text_rectangle, image_rectangle, pe.ClipRectangle);
+ else
+ ThemeEngine.Current.DrawRadioButton (pe.Graphics, this.ClientRectangle, this);
+#else
ThemeEngine.Current.DrawRadioButton (pe.Graphics, this.ClientRectangle, this);
+#endif
+ }
+
+#if NET_2_0
+ internal override Size GetPreferredSizeCore (Size proposedSize)
+ {
+ if (this.AutoSize)
+ return ThemeEngine.Current.CalculateRadioButtonAutoSize (this);
+
+ return base.GetPreferredSizeCore (proposedSize);
}
+#endif
#endregion // Private Methods
#region Public Instance Properties
EventHandler eh = (EventHandler)(Events [AppearanceChangedEvent]);
if (eh != null)
eh (this, EventArgs.Empty);
- Redraw();
+ if (Parent != null)
+ Parent.PerformLayout (this, "Appearance");
+ Invalidate();
}
}
}
if (value != radiobutton_alignment) {
radiobutton_alignment = value;
- Redraw();
+ Invalidate();
}
}
}
if (value && (check_state != CheckState.Checked)) {
UpdateSiblings();
check_state = CheckState.Checked;
- Redraw();
+ Invalidate();
OnCheckedChanged(EventArgs.Empty);
} else if (!value && (check_state != CheckState.Unchecked)) {
check_state = CheckState.Unchecked;
- Redraw();
+ Invalidate();
OnCheckedChanged(EventArgs.Empty);
}
}
[DefaultValue(ContentAlignment.MiddleLeft)]
[Localizable(true)]
public override ContentAlignment TextAlign {
- get {
- return text_alignment;
- }
-
- set {
- if (value != text_alignment) {
- text_alignment = value;
- Redraw();
- }
- }
+ get { return base.TextAlign; }
+ set { base.TextAlign = value; }
}
#endregion // Public Instance Properties
}
#if NET_2_0
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
public new event MouseEventHandler MouseDoubleClick {
add { base.MouseDoubleClick += value; }
remove { base.MouseDoubleClick -= value; }