//
//
-// COMPLETE
-
using System.Drawing;
using System.ComponentModel;
using System.ComponentModel.Design;
+using System.Runtime.InteropServices;
namespace System.Windows.Forms
{
[DefaultProperty("Text")]
[DefaultEvent("Enter")]
- [Designer ("System.Windows.Forms.Design.GroupBoxDesigner, " + Consts.AssemblySystem_Design, (string)null)]
+ [Designer ("System.Windows.Forms.Design.GroupBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+#if NET_2_0
+ [ClassInterface (ClassInterfaceType.AutoDispatch)]
+ [ComVisible (true)]
+#endif
public class GroupBox : Control
{
private FlatStyle flat_style;
#region Events
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event EventHandler Click;
+ public new event EventHandler Click {
+ add { base.Click += value; }
+ remove { base.Click -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event EventHandler DoubleClick;
+ public new event EventHandler DoubleClick {
+ add { base.DoubleClick += value; }
+ remove { base.DoubleClick -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event KeyEventHandler KeyDown;
+ public new event KeyEventHandler KeyDown {
+ add { base.KeyDown += value; }
+ remove { base.KeyDown -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event KeyPressEventHandler KeyPress;
+ public new event KeyPressEventHandler KeyPress {
+ add { base.KeyPress += value; }
+ remove { base.KeyPress -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event KeyEventHandler KeyUp;
+ public new event KeyEventHandler KeyUp {
+ add { base.KeyUp += value; }
+ remove { base.KeyUp -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event MouseEventHandler MouseDown;
+ public new event MouseEventHandler MouseDown {
+ add { base.MouseDown += value; }
+ remove { base.MouseDown -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event EventHandler MouseEnter;
+ public new event EventHandler MouseEnter {
+ add { base.MouseEnter += value; }
+ remove { base.MouseEnter -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event EventHandler MouseLeave;
+ public new event EventHandler MouseLeave {
+ add { base.MouseLeave += value; }
+ remove { base.MouseLeave -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event MouseEventHandler MouseMove;
+ public new event MouseEventHandler MouseMove {
+ add { base.MouseMove += value; }
+ remove { base.MouseMove -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event MouseEventHandler MouseUp;
+ public new event MouseEventHandler MouseUp {
+ add { base.MouseUp += value; }
+ remove { base.MouseUp -= value; }
+ }
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public new event EventHandler TabStopChanged;
+ public new event EventHandler TabStopChanged {
+ add { base.TabStopChanged += value; }
+ remove { base.TabStopChanged -= value; }
+ }
#endregion Events
public GroupBox ()
TabStop = false;
flat_style = FlatStyle.Standard;
- SetStyle(ControlStyles.ContainerControl, true);
+ SetStyle(ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Selectable, false);
- SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
}
#region Public Properties
protected override void OnPaint (PaintEventArgs pevent)
{
- Draw ();
- pevent.Graphics.DrawImage (ImageBuffer, 0, 0);
+ ThemeEngine.Current.DrawGroupBox (pevent.Graphics, ClientRectangle, this);
+ base.OnPaint(pevent);
}
protected override bool ProcessMnemonic (char charCode)
{
if (IsMnemonic(charCode, Text) == true) {
// Select item next in line in tab order
- if (this.parent != null) {
- parent.SelectNextControl(this, true, false, true, false);
+ if (this.Parent != null) {
+ Parent.SelectNextControl(this, true, false, true, false);
}
return true;
}
}
protected override void WndProc(ref Message m) {
- switch ((Msg) m.Msg) {
- case Msg.WM_ERASEBKGND:
- m.Result = (IntPtr)1;
- break;
- default:
- base.WndProc (ref m);
- break;
- }
+ base.WndProc (ref m);
}
#endregion Public Methods
-
- #region Private Methods
+#if NET_2_0
+ [DefaultValue (false)]
+ public bool UseCompatibleTextRendering {
+ get {
+ return use_compatible_text_rendering;
+ }
- private void Draw ()
- {
- ThemeEngine.Current.DrawGroupBox (DeviceContext, ClientRectangle, this);
+ set {
+ use_compatible_text_rendering = value;
+ }
}
-
- #endregion // Private Methods
+#endif
}
}