1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2004-2006 Novell, Inc.
23 // Peter Bartok pbartok@novell.com
30 using System.ComponentModel;
31 using System.ComponentModel.Design;
32 using System.ComponentModel.Design.Serialization;
33 using System.Collections;
34 using System.Runtime.InteropServices;
35 using System.Threading;
37 namespace System.Windows.Forms {
38 [DesignerCategory("Form")]
39 [DesignTimeVisible(false)]
40 [Designer("System.Windows.Forms.Design.FormDocumentDesigner, " + Consts.AssemblySystem_Design, typeof(IRootDesigner))]
41 [DefaultEvent("Load")]
43 public class Form : ContainerControl {
44 #region Local Variables
45 internal bool closing;
46 FormBorderStyle form_border_style;
47 private bool autoscale;
48 private Size clientsize_set;
49 private Size autoscale_base_size;
50 private bool allow_transparency;
51 private static Icon default_icon;
52 internal bool is_modal;
53 internal FormWindowState window_state;
54 private bool control_box;
55 private bool minimize_box;
56 private bool maximize_box;
57 private bool help_button;
58 private bool show_in_taskbar;
60 private IButtonControl accept_button;
61 private IButtonControl cancel_button;
62 private DialogResult dialog_result;
63 private FormStartPosition start_position;
65 private Form.ControlCollection owned_forms;
66 private MdiClient mdi_container;
67 internal InternalWindowManager window_manager;
68 private Form mdi_parent;
69 private bool key_preview;
70 private MainMenu menu;
72 private Size maximum_size;
73 private Size minimum_size;
74 private SizeGripStyle size_grip_style;
75 private Rectangle maximized_bounds;
76 private Rectangle default_maximized_bounds;
77 private double opacity;
78 internal ApplicationContext context;
79 Color transparency_key;
80 internal MenuTracker active_tracker;
81 private bool is_loaded;
83 #endregion // Local Variables
85 #region Private & Internal Methods
88 default_icon = (Icon)Locale.GetResource("mono.ico");
91 // warning: this is only hooked up when an mdi container is created.
92 private void ControlAddedHandler (object sender, ControlEventArgs e)
94 if (mdi_container != null) {
95 mdi_container.SendToBack ();
99 private void SelectActiveControl ()
101 if (this.IsMdiContainer)
104 if (this.ActiveControl == null) {
107 // This visible hack is to work around CanSelect always being false if one of the parents
108 // is not visible; and we by default create Form invisible...
109 visible = this.is_visible;
110 this.is_visible = true;
112 if (SelectNextControl (this, true, true, true, true) == false) {
116 this.is_visible = visible;
118 Select (ActiveControl);
121 #endregion // Private & Internal Methods
123 #region Public Classes
124 public new class ControlCollection : Control.ControlCollection {
127 public ControlCollection(Form owner) : base(owner) {
128 this.form_owner = owner;
131 public override void Add(Control value) {
132 if (Contains (value))
135 ((Form)value).owner=(Form)owner;
138 public override void Remove(Control value) {
139 ((Form)value).owner = null;
143 #endregion // Public Classes
145 #region Public Constructor & Destructor
148 SizeF current_scale = GetAutoScaleSize (DeviceContext, Font);
151 autoscale_base_size = new Size ((int)current_scale.Width, (int) current_scale.Height);
152 allow_transparency = false;
155 dialog_result = DialogResult.None;
156 start_position = FormStartPosition.WindowsDefaultLocation;
157 form_border_style = FormBorderStyle.Sizable;
158 window_state = FormWindowState.Normal;
163 minimum_size = Size.Empty;
164 maximum_size = Size.Empty;
165 clientsize_set = Size.Empty;
170 show_in_taskbar = true;
171 ime_mode = ImeMode.NoControl;
174 size_grip_style = SizeGripStyle.Auto;
175 maximized_bounds = Rectangle.Empty;
176 default_maximized_bounds = Rectangle.Empty;
177 owned_forms = new Form.ControlCollection(this);
178 transparency_key = Color.Empty;
182 #endregion // Public Constructor & Destructor
184 #region Public Static Properties
186 public static Form ActiveForm {
190 active = FromHandle(XplatUI.GetActive());
192 if (active != null) {
193 if ( !(active is Form)) {
196 parent = active.Parent;
197 while (parent != null) {
198 if (parent is Form) {
201 parent = parent.Parent;
211 #endregion // Public Static Properties
213 #region Public Instance Properties
215 public IButtonControl AcceptButton {
217 return accept_button;
221 accept_button = value;
227 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
228 public bool AllowTransparency {
230 return allow_transparency;
234 if (value == allow_transparency) {
238 if (XplatUI.SupportsTransparency()) {
239 allow_transparency = value;
242 if (IsHandleCreated) {
243 XplatUI.SetWindowTransparency(Handle, Opacity, TransparencyKey);
246 UpdateStyles(); // Remove the WS_EX_LAYERED style
253 [MWFCategory("Layout")]
254 public bool AutoScale {
266 [EditorBrowsable(EditorBrowsableState.Advanced)]
267 public virtual Size AutoScaleBaseSize {
269 return autoscale_base_size;
273 autoscale_base_size = value;
278 public override bool AutoScroll {
280 return base.AutoScroll;
283 base.AutoScroll = value;
287 public override Color BackColor {
289 /* we don't let parents override our
290 default background color for forms.
291 this fixes the default color for mdi
293 if (background_color.IsEmpty)
294 return DefaultBackColor;
296 return background_color;
299 base.BackColor = value;
304 public IButtonControl CancelButton {
306 return cancel_button;
310 cancel_button = value;
314 [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
316 public Size ClientSize {
318 return base.ClientSize;
322 base.ClientSize = value;
327 [MWFCategory("Window Style")]
328 public bool ControlBox {
334 if (control_box != value) {
342 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
343 public Rectangle DesktopBounds {
345 return new Rectangle(Location, Size);
354 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
355 public Point DesktopLocation {
366 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
367 public DialogResult DialogResult {
369 return dialog_result;
373 if (value < DialogResult.None || value > DialogResult.No)
374 throw new InvalidEnumArgumentException ("value", (int) value,
375 typeof (DialogResult));
377 dialog_result = value;
378 closing = (dialog_result != DialogResult.None && is_modal);
382 [DefaultValue(FormBorderStyle.Sizable)]
384 [MWFCategory("Appearance")]
385 public FormBorderStyle FormBorderStyle {
387 return form_border_style;
390 form_border_style = value;
392 if (window_manager == null) {
393 if (IsHandleCreated) {
394 XplatUI.SetBorderStyle(window.Handle, form_border_style);
397 window_manager.UpdateBorderStyle (value);
404 [DefaultValue(false)]
405 [MWFCategory("Window Style")]
406 public bool HelpButton {
412 if (help_button != value) {
421 [MWFCategory("Window Style")]
431 if (IsHandleCreated) {
432 XplatUI.SetIcon(Handle, icon == null ? default_icon : icon);
439 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
440 public bool IsMdiChild {
442 return mdi_parent != null;
446 [DefaultValue(false)]
447 [MWFCategory("Window Style")]
448 public bool IsMdiContainer {
450 return mdi_container != null;
454 if (value && mdi_container == null) {
455 mdi_container = new MdiClient ();
456 Controls.Add(mdi_container);
457 ControlAdded += new ControlEventHandler (ControlAddedHandler);
458 mdi_container.SendToBack ();
459 } else if (!value && mdi_container != null) {
460 Controls.Remove(mdi_container);
461 mdi_container = null;
467 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
468 public Form ActiveMdiChild {
472 return (Form) mdi_container.ActiveMdiChild;
477 [EditorBrowsable(EditorBrowsableState.Advanced)]
478 public bool IsRestrictedWindow {
484 [DefaultValue(false)]
485 public bool KeyPreview {
496 [MWFCategory("Window Style")]
497 public bool MaximizeBox {
502 if (maximize_box != value) {
503 maximize_box = value;
504 if (IsHandleCreated) {
512 [DefaultValue("{Width=0, Height=0}")]
514 [RefreshProperties(RefreshProperties.Repaint)]
515 [MWFCategory("Layout")]
516 public Size MaximumSize {
522 if (maximum_size != value) {
523 maximum_size = value;
524 OnMaximumSizeChanged(EventArgs.Empty);
525 if (IsHandleCreated) {
526 XplatUI.SetWindowMinMax(Handle, maximized_bounds, minimum_size, maximum_size);
533 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
534 public Form[] MdiChildren {
536 if (mdi_container != null)
537 return mdi_container.MdiChildren;
544 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
545 public Form MdiParent {
551 if (value != null && !value.IsMdiContainer)
552 throw new ArgumentException ();
554 if (mdi_parent != null) {
555 mdi_parent.MdiContainer.Controls.Remove (this);
560 window_manager = new MdiWindowManager (this,
561 mdi_parent.MdiContainer);
562 mdi_parent.MdiContainer.Controls.Add (this);
566 } else if (mdi_parent != null) {
569 // Create a new window manager
570 window_manager = null;
571 FormBorderStyle = form_border_style;
578 internal MenuTracker ActiveTracker {
579 get { return active_tracker; }
581 if (value == active_tracker)
584 Capture = value != null;
585 active_tracker = value;
589 internal MdiClient MdiContainer {
590 get { return mdi_container; }
593 internal InternalWindowManager WindowManager {
594 get { return window_manager; }
598 [MWFCategory("Window Style")]
599 public MainMenu Menu {
608 if (menu != null && !IsMdiChild) {
611 if (IsHandleCreated) {
612 XplatUI.SetMenu (window.Handle, menu);
615 if (clientsize_set != Size.Empty) {
616 SetClientSizeCore(clientsize_set.Width, clientsize_set.Height);
618 UpdateBounds (bounds.X, bounds.Y, bounds.Width, bounds.Height, ClientSize.Width, ClientSize.Height -
619 ThemeEngine.Current.CalcMenuBarSize (DeviceContext, menu, ClientSize.Width));
628 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
629 [EditorBrowsable(EditorBrowsableState.Advanced)]
630 public MainMenu MergedMenu {
632 if (!IsMdiChild || window_manager == null)
634 return ((MdiWindowManager) window_manager).MergedMenu;
638 // This is the menu in display and being used because of merging this can
639 // be different then the menu that is actually assosciated with the form
640 internal MainMenu ActiveMenu {
645 if (IsMdiContainer && mdi_container.Controls.Count > 0 &&
646 ((Form) mdi_container.Controls [0]).WindowState == FormWindowState.Maximized) {
647 MdiWindowManager wm = (MdiWindowManager) ((Form) mdi_container.Controls [0]).WindowManager;
648 return wm.MaximizedMenu;
651 Form amc = ActiveMdiChild;
652 if (amc == null || amc.Menu == null)
654 return amc.MergedMenu;
658 internal MdiWindowManager ActiveMaximizedMdiChild {
660 Form child = ActiveMdiChild;
663 if (child.WindowManager == null || child.window_state != FormWindowState.Maximized)
665 return (MdiWindowManager) child.WindowManager;
670 [MWFCategory("Window Style")]
671 public bool MinimizeBox {
676 if (minimize_box != value) {
677 minimize_box = value;
678 if (IsHandleCreated) {
686 [DefaultValue("{Width=0, Height=0}")]
688 [RefreshProperties(RefreshProperties.Repaint)]
689 [MWFCategory("Layout")]
690 public Size MinimumSize {
696 if (minimum_size != value) {
697 minimum_size = value;
699 if ((Size.Width < value.Width) || (Size.Height < value.Height)) {
700 Size = new Size(Math.Max(Size.Width, value.Width), Math.Max(Size.Height, value.Height));
704 OnMinimumSizeChanged(EventArgs.Empty);
705 if (IsHandleCreated) {
706 XplatUI.SetWindowMinMax(Handle, maximized_bounds, minimum_size, maximum_size);
713 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
721 [TypeConverter(typeof(OpacityConverter))]
722 [MWFCategory("Window Style")]
723 public double Opacity {
731 AllowTransparency = true;
733 if (IsHandleCreated) {
735 XplatUI.SetWindowTransparency(Handle, opacity, TransparencyKey);
742 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
743 public Form[] OwnedForms {
747 form_list = new Form[owned_forms.Count];
749 for (int i=0; i<owned_forms.Count; i++) {
750 form_list[i] = (Form)owned_forms[i];
758 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
765 if (owner != value) {
767 owner.RemoveOwnedForm(this);
771 owner.AddOwnedForm(this);
772 if (IsHandleCreated) {
773 if (owner != null && owner.IsHandleCreated) {
774 XplatUI.SetTopmost(this.window.Handle, owner.window.Handle, true);
776 XplatUI.SetTopmost(this.window.Handle, IntPtr.Zero, false);
784 [MWFCategory("Window Style")]
785 public bool ShowInTaskbar {
787 return show_in_taskbar;
790 if (show_in_taskbar != value) {
791 show_in_taskbar = value;
792 if (IsHandleCreated) {
800 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
812 [MonoTODO("Trigger something when GripStyle is set")]
813 [DefaultValue(SizeGripStyle.Auto)]
814 [MWFCategory("Window Style")]
815 public SizeGripStyle SizeGripStyle {
817 return size_grip_style;
821 size_grip_style = value;
825 [DefaultValue(FormStartPosition.WindowsDefaultLocation)]
827 [MWFCategory("Layout")]
828 public FormStartPosition StartPosition {
830 return start_position;
834 if (start_position == FormStartPosition.WindowsDefaultLocation) { // Only do this if it's not set yet
835 start_position = value;
836 if (IsHandleCreated) {
837 switch(start_position) {
838 case FormStartPosition.CenterParent: {
843 case FormStartPosition.CenterScreen: {
848 case FormStartPosition.Manual: {
849 Left = CreateParams.X;
850 Top = CreateParams.Y;
864 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
865 [EditorBrowsable(EditorBrowsableState.Never)]
866 public int TabIndex {
868 return base.TabIndex;
872 base.TabIndex = value;
877 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
878 [EditorBrowsable(EditorBrowsableState.Advanced)]
879 public bool TopLevel {
881 return GetTopLevel();
885 if (!value && IsMdiContainer)
886 throw new ArgumentException ("MDI Container forms must be top level.");
891 [DefaultValue(false)]
892 [MWFCategory("Window Style")]
893 public bool TopMost {
899 if (topmost != value) {
902 XplatUI.SetTopmost(window.Handle, owner != null ? owner.window.Handle : IntPtr.Zero, value);
907 [MWFCategory("Window Style")]
908 public Color TransparencyKey {
910 return transparency_key;
914 transparency_key = value;
916 AllowTransparency = true;
918 XplatUI.SetWindowTransparency(Handle, Opacity, transparency_key);
922 [DefaultValue(FormWindowState.Normal)]
923 [MWFCategory("Layout")]
924 public FormWindowState WindowState {
926 if (IsHandleCreated) {
928 if (window_manager != null)
929 return window_manager.GetWindowState ();
931 FormWindowState new_state = XplatUI.GetWindowState(Handle);
932 if (new_state != (FormWindowState)(-1))
933 window_state = new_state;
940 FormWindowState old_state = window_state;
941 window_state = value;
942 if (IsHandleCreated) {
944 if (window_manager != null) {
945 window_manager.SetWindowState (old_state, value);
949 XplatUI.SetWindowState(Handle, value);
954 #endregion // Public Instance Properties
956 #region Protected Instance Properties
957 protected override CreateParams CreateParams {
959 CreateParams cp = new CreateParams ();
962 cp.ClassName = XplatUI.DefaultClassName;
967 cp.Parent = IntPtr.Zero;
968 cp.menu = ActiveMenu;
970 if (start_position == FormStartPosition.WindowsDefaultLocation && !IsMdiChild) {
971 cp.X = unchecked((int)0x80000000);
972 cp.Y = unchecked((int)0x80000000);
980 cp.Style = (int)(WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS);
983 cp.Style |= (int)(WindowStyles.WS_CHILD | WindowStyles.WS_CAPTION);
984 if (Parent != null) {
985 cp.Parent = Parent.Handle;
988 cp.ExStyle |= (int) (WindowExStyles.WS_EX_WINDOWEDGE | WindowExStyles.WS_EX_MDICHILD);
990 switch (FormBorderStyle) {
991 case FormBorderStyle.None:
993 case FormBorderStyle.FixedToolWindow:
994 case FormBorderStyle.SizableToolWindow:
995 cp.ExStyle |= (int) WindowExStyles.WS_EX_TOOLWINDOW;
998 cp.Style |= (int) WindowStyles.WS_OVERLAPPEDWINDOW;
1003 switch (FormBorderStyle) {
1004 case FormBorderStyle.Fixed3D: {
1005 cp.Style |= (int)(WindowStyles.WS_CAPTION | WindowStyles.WS_BORDER);
1006 cp.ExStyle |= (int)WindowExStyles.WS_EX_CLIENTEDGE;
1010 case FormBorderStyle.FixedDialog: {
1011 cp.Style |= (int)(WindowStyles.WS_CAPTION | WindowStyles.WS_BORDER);
1012 cp.ExStyle |= (int)(WindowExStyles.WS_EX_DLGMODALFRAME | WindowExStyles.WS_EX_CONTROLPARENT);
1016 case FormBorderStyle.FixedSingle: {
1017 cp.Style |= (int)(WindowStyles.WS_CAPTION | WindowStyles.WS_BORDER);
1021 case FormBorderStyle.FixedToolWindow: {
1022 cp.Style |= (int)(WindowStyles.WS_CAPTION | WindowStyles.WS_BORDER);
1023 cp.ExStyle |= (int)(WindowExStyles.WS_EX_TOOLWINDOW);
1027 case FormBorderStyle.Sizable: {
1028 cp.Style |= (int)(WindowStyles.WS_BORDER | WindowStyles.WS_THICKFRAME | WindowStyles.WS_CAPTION);
1032 case FormBorderStyle.SizableToolWindow: {
1033 cp.Style |= (int)(WindowStyles.WS_BORDER | WindowStyles.WS_THICKFRAME | WindowStyles.WS_CAPTION);
1034 cp.ExStyle |= (int)(WindowExStyles.WS_EX_TOOLWINDOW);
1038 case FormBorderStyle.None: {
1044 switch(window_state) {
1045 case FormWindowState.Maximized: {
1046 cp.Style |= (int)WindowStyles.WS_MAXIMIZE;
1050 case FormWindowState.Minimized: {
1051 cp.Style |= (int)WindowStyles.WS_MINIMIZE;
1057 cp.ExStyle |= (int) WindowExStyles.WS_EX_TOPMOST;
1060 if (ShowInTaskbar) {
1061 cp.ExStyle |= (int)WindowExStyles.WS_EX_APPWINDOW;
1065 cp.Style |= (int)WindowStyles.WS_MAXIMIZEBOX;
1069 cp.Style |= (int)WindowStyles.WS_MINIMIZEBOX;
1073 cp.Style |= (int)WindowStyles.WS_SYSMENU;
1076 if (HelpButton && !MaximizeBox && !MinimizeBox) {
1077 cp.ExStyle |= (int)WindowExStyles.WS_EX_CONTEXTHELP;
1081 cp.Style |= (int)WindowStyles.WS_VISIBLE;
1083 if (Opacity < 1.0 || TransparencyKey != Color.Empty) {
1084 cp.ExStyle |= (int)WindowExStyles.WS_EX_LAYERED;
1087 if (!is_enabled && context == null) {
1088 cp.Style |= (int)(WindowStyles.WS_DISABLED);
1095 protected override ImeMode DefaultImeMode {
1097 return ImeMode.NoControl;
1101 protected override Size DefaultSize {
1103 return new Size (300, 300);
1107 protected Rectangle MaximizedBounds {
1109 if (maximized_bounds != Rectangle.Empty) {
1110 return maximized_bounds;
1112 return default_maximized_bounds;
1116 maximized_bounds = value;
1117 OnMaximizedBoundsChanged(EventArgs.Empty);
1118 if (IsHandleCreated) {
1119 XplatUI.SetWindowMinMax(Handle, maximized_bounds, minimum_size, maximum_size);
1123 #endregion // Protected Instance Properties
1125 #region Public Static Methods
1126 [EditorBrowsable(EditorBrowsableState.Advanced)]
1127 public static SizeF GetAutoScaleSize (Font font)
1129 return XplatUI.GetAutoScaleSize(font);
1132 #endregion // Public Static Methods
1134 #region Public Instance Methods
1135 internal SizeF GetAutoScaleSize (Graphics g, Font font)
1138 // The following constants come from the dotnet mailing list
1139 // discussion: http://discuss.develop.com/archives/wa.exe?A2=ind0203A&L=DOTNET&P=R3655
1141 // The magic number is "Its almost the length
1142 // of the string with a smattering added in
1143 // for compat with earlier code".
1146 string magic_string = "The quick brown fox jumped over the lazy dog.";
1147 double magic_number = 44.549996948242189;
1148 float width = (float) (g.MeasureString (magic_string, font).Width / magic_number);
1150 return new SizeF (width, font.Height);
1153 public void Activate() {
1156 // The docs say activate only activates if our app is already active
1157 if (IsHandleCreated) {
1159 MdiParent.ActivateMdiChild (this);
1161 active = ActiveForm;
1162 if ((active != null) && (this != active)) {
1163 XplatUI.Activate(window.Handle);
1169 public void AddOwnedForm(Form ownedForm) {
1170 if (!owned_forms.Contains(ownedForm)) {
1171 owned_forms.Add(ownedForm);
1173 ownedForm.Owner = this;
1176 public void Close () {
1183 XplatUI.SendMessage(this.Handle, Msg.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
1186 public void LayoutMdi(MdiLayout value) {
1187 if (mdi_container != null) {
1188 mdi_container.LayoutMdi(value);
1192 public void RemoveOwnedForm(Form ownedForm) {
1193 owned_forms.Remove(ownedForm);
1196 public void SetDesktopBounds(int x, int y, int width, int height) {
1197 DesktopBounds = new Rectangle(x, y, width, height);
1200 public void SetDesktopLocation(int x, int y) {
1201 DesktopLocation = new Point(x, y);
1204 public DialogResult ShowDialog() {
1205 return ShowDialog(this.owner);
1208 public DialogResult ShowDialog(IWin32Window ownerWin32) {
1211 IntPtr capture_window;
1215 if (ownerWin32 != null) {
1216 Control c = Control.FromHandle (ownerWin32.Handle);
1218 owner = c.TopLevelControl as Form;
1221 if (owner == this) {
1222 throw new InvalidOperationException("The 'ownerWin32' cannot be the form being shown.");
1226 throw new InvalidOperationException("The form is already displayed as a modal dialog.");
1230 throw new InvalidOperationException("Already visible forms cannot be displayed as a modal dialog. Set the Visible property to 'false' prior to calling Form.ShowDialog.");
1234 throw new InvalidOperationException("Cannot display a disabled form as modal dialog.");
1237 if (TopLevelControl != this) {
1238 throw new InvalidOperationException("Can only display TopLevel forms as modal dialog.");
1242 // Can't do this, will screw us in the modal loop
1243 form_parent_window.Parent = this.owner;
1246 // Release any captures
1247 XplatUI.GrabInfo(out capture_window, out confined, out area);
1248 if (capture_window != IntPtr.Zero) {
1249 XplatUI.UngrabWindow(capture_window);
1253 // Commented out; we instead let the Visible=true inside the runloop create the control
1254 // otherwise setting DialogResult inside any of the events that are triggered by the
1255 // create will not actually cause the form to not be displayed.
1256 // Leaving this comment here in case there was an actual purpose to creating the control
1258 if (!IsHandleCreated) {
1263 Application.RunLoop(true, new ApplicationContext(this));
1265 if (owner != null) {
1266 // Cannot use Activate(), it has a check for the current active window...
1267 XplatUI.Activate(owner.window.Handle);
1270 if (DialogResult != DialogResult.None) {
1271 return DialogResult;
1273 DialogResult = DialogResult.Cancel;
1274 return DialogResult.Cancel;
1277 public override string ToString() {
1278 return GetType().FullName.ToString() + ", Text: " + Text;
1280 #endregion // Public Instance Methods
1282 #region Protected Instance Methods
1283 protected void ActivateMdiChild(Form form) {
1284 if (!IsMdiContainer)
1286 mdi_container.ActivateChild (form);
1287 OnMdiChildActivate(EventArgs.Empty);
1290 [EditorBrowsable(EditorBrowsableState.Advanced)]
1291 protected override void AdjustFormScrollbars(bool displayScrollbars) {
1292 base.AdjustFormScrollbars (displayScrollbars);
1295 [EditorBrowsable(EditorBrowsableState.Advanced)]
1296 protected void ApplyAutoScaling()
1298 SizeF current_size_f = GetAutoScaleSize (DeviceContext, Font);
1299 Size current_size = new Size ((int) current_size_f.Width, (int) current_size_f.Height);
1303 if (current_size == autoscale_base_size)
1306 if (Environment.GetEnvironmentVariable ("MONO_MWF_SCALING") == "disable"){
1311 // I tried applying the Fudge height factor from:
1312 // http://blogs.msdn.com/mharsh/archive/2004/01/25/62621.aspx
1313 // but it makes things larger without looking better.
1315 if (current_size_f.Width != AutoScaleBaseSize.Width) {
1316 dx = current_size_f.Width / AutoScaleBaseSize.Width + 0.08f;
1321 if (current_size_f.Height != AutoScaleBaseSize.Height) {
1322 dy = current_size_f.Height / AutoScaleBaseSize.Height + 0.08f;
1329 AutoScaleBaseSize = current_size;
1332 protected void CenterToParent() {
1340 w = DefaultSize.Width;
1346 h = DefaultSize.Height;
1350 if (parent != null) {
1352 } else if (owner != null) {
1356 if (owner != null) {
1357 this.Location = new Point(ctl.Left + ctl.Width / 2 - w /2, ctl.Top + ctl.Height / 2 - h / 2);
1361 protected void CenterToScreen() {
1369 w = DefaultSize.Width;
1375 h = DefaultSize.Height;
1378 XplatUI.GetDisplaySize(out DisplaySize);
1379 this.Location = new Point(DisplaySize.Width / 2 - w / 2, DisplaySize.Height / 2 - h / 2);
1382 [EditorBrowsable(EditorBrowsableState.Advanced)]
1383 protected override Control.ControlCollection CreateControlsInstance() {
1384 return base.CreateControlsInstance ();
1387 [EditorBrowsable(EditorBrowsableState.Advanced)]
1388 protected override void CreateHandle() {
1389 base.CreateHandle ();
1393 if (XplatUI.SupportsTransparency()) {
1394 if (allow_transparency) {
1395 XplatUI.SetWindowTransparency(Handle, Opacity, TransparencyKey);
1399 XplatUI.SetWindowMinMax(window.Handle, maximized_bounds, minimum_size, maximum_size);
1400 if ((FormBorderStyle != FormBorderStyle.FixedDialog) && (icon != null)) {
1401 XplatUI.SetIcon(window.Handle, icon);
1404 if ((owner != null) && (owner.IsHandleCreated)) {
1405 XplatUI.SetTopmost(window.Handle, owner.window.Handle, true);
1408 for (int i = 0; i < owned_forms.Count; i++) {
1409 if (owned_forms[i].IsHandleCreated)
1410 XplatUI.SetTopmost(owned_forms[i].window.Handle, window.Handle, true);
1413 if (window_manager != null && window_state != FormWindowState.Normal) {
1414 window_manager.SetWindowState (FormWindowState.Normal, window_state);
1419 [EditorBrowsable(EditorBrowsableState.Advanced)]
1420 protected override void DefWndProc(ref Message m) {
1421 base.DefWndProc (ref m);
1424 protected override void Dispose(bool disposing)
1426 for (int i = 0; i < owned_forms.Count; i++)
1427 ((Form)owned_forms[i]).Owner = null;
1429 owned_forms.Clear ();
1431 base.Dispose (disposing);
1434 [EditorBrowsable(EditorBrowsableState.Advanced)]
1435 protected virtual void OnActivated(EventArgs e)
1438 SelectActiveControl ();
1440 if (Activated != null) {
1445 [EditorBrowsable(EditorBrowsableState.Advanced)]
1446 protected virtual void OnClosed(EventArgs e) {
1447 if (Closed != null) {
1452 [EditorBrowsable(EditorBrowsableState.Advanced)]
1453 protected virtual void OnClosing(System.ComponentModel.CancelEventArgs e) {
1454 if (Closing != null) {
1459 [EditorBrowsable(EditorBrowsableState.Advanced)]
1460 protected override void OnCreateControl() {
1461 base.OnCreateControl ();
1464 XplatUI.SetMenu(window.Handle, menu);
1467 OnLoad(EventArgs.Empty);
1469 SelectActiveControl ();
1471 // Send initial location
1472 OnLocationChanged(EventArgs.Empty);
1474 if (IsMdiContainer) {
1475 mdi_container.LayoutMdi (MdiLayout.Cascade);
1479 [EditorBrowsable(EditorBrowsableState.Advanced)]
1480 protected virtual void OnDeactivate(EventArgs e) {
1481 if (Deactivate != null) {
1482 Deactivate(this, e);
1486 [EditorBrowsable(EditorBrowsableState.Advanced)]
1487 protected override void OnFontChanged(EventArgs e) {
1488 base.OnFontChanged (e);
1491 [EditorBrowsable(EditorBrowsableState.Advanced)]
1492 protected override void OnHandleCreated(EventArgs e) {
1493 XplatUI.SetBorderStyle(window.Handle, form_border_style);
1494 base.OnHandleCreated (e);
1497 [EditorBrowsable(EditorBrowsableState.Advanced)]
1498 protected override void OnHandleDestroyed(EventArgs e) {
1499 base.OnHandleDestroyed (e);
1502 [EditorBrowsable(EditorBrowsableState.Advanced)]
1503 protected virtual void OnInputLanguageChanged(InputLanguageChangedEventArgs e) {
1504 if (InputLanguageChanged!=null) {
1505 InputLanguageChanged(this, e);
1509 [EditorBrowsable(EditorBrowsableState.Advanced)]
1510 protected virtual void OnInputLanguageChanging(InputLanguageChangingEventArgs e) {
1511 if (InputLanguageChanging!=null) {
1512 InputLanguageChanging(this, e);
1516 [EditorBrowsable(EditorBrowsableState.Advanced)]
1517 protected virtual void OnLoad(EventArgs e) {
1519 ApplyAutoScaling ();
1528 switch (StartPosition) {
1529 case FormStartPosition.CenterScreen:
1530 this.CenterToScreen();
1532 case FormStartPosition.CenterParent:
1533 this.CenterToParent ();
1535 case FormStartPosition.Manual:
1536 Left = CreateParams.X;
1537 Top = CreateParams.Y;
1544 [EditorBrowsable(EditorBrowsableState.Advanced)]
1545 protected virtual void OnMaximizedBoundsChanged(EventArgs e) {
1546 if (MaximizedBoundsChanged != null) {
1547 MaximizedBoundsChanged(this, e);
1551 [EditorBrowsable(EditorBrowsableState.Advanced)]
1552 protected virtual void OnMaximumSizeChanged(EventArgs e) {
1553 if (MaximumSizeChanged != null) {
1554 MaximumSizeChanged(this, e);
1558 [EditorBrowsable(EditorBrowsableState.Advanced)]
1559 protected virtual void OnMdiChildActivate(EventArgs e) {
1560 if (MdiChildActivate != null) {
1561 MdiChildActivate(this, e);
1565 [EditorBrowsable(EditorBrowsableState.Advanced)]
1566 protected virtual void OnMenuComplete(EventArgs e) {
1567 if (MenuComplete != null) {
1568 MenuComplete(this, e);
1572 [EditorBrowsable(EditorBrowsableState.Advanced)]
1573 protected virtual void OnMenuStart(EventArgs e) {
1574 if (MenuStart != null) {
1579 [EditorBrowsable(EditorBrowsableState.Advanced)]
1580 protected virtual void OnMinimumSizeChanged(EventArgs e) {
1581 if (MinimumSizeChanged != null) {
1582 MinimumSizeChanged(this, e);
1586 [EditorBrowsable(EditorBrowsableState.Advanced)]
1587 protected override void OnPaint (PaintEventArgs pevent) {
1588 base.OnPaint (pevent);
1591 [EditorBrowsable(EditorBrowsableState.Advanced)]
1592 protected override void OnResize(EventArgs e) {
1595 if (this.IsMdiChild)
1597 ParentForm.PerformLayout();
1598 ParentForm.Size = ParentForm.Size;
1602 [EditorBrowsable(EditorBrowsableState.Advanced)]
1603 protected override void OnStyleChanged(EventArgs e) {
1604 base.OnStyleChanged (e);
1607 [EditorBrowsable(EditorBrowsableState.Advanced)]
1608 protected override void OnTextChanged(EventArgs e) {
1609 base.OnTextChanged (e);
1611 if (mdi_container != null)
1612 mdi_container.SetParentText(true);
1615 [EditorBrowsable(EditorBrowsableState.Advanced)]
1616 protected override void OnVisibleChanged(EventArgs e) {
1617 base.OnVisibleChanged (e);
1620 if (window_manager != null)
1621 window_manager.SetWindowState (WindowState, WindowState);
1625 protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
1626 if (base.ProcessCmdKey (ref msg, keyData)) {
1630 // Give our menu a shot
1631 if (ActiveMenu != null) {
1632 return ActiveMenu.ProcessCmdKey(ref msg, keyData);
1638 // LAMESPEC - Not documented that Form overrides ProcessDialogChar; class-status showed
1639 [EditorBrowsable (EditorBrowsableState.Advanced)]
1640 protected override bool ProcessDialogChar(char charCode) {
1641 return base.ProcessDialogChar (charCode);
1644 protected override bool ProcessDialogKey(Keys keyData) {
1645 if ((keyData & Keys.Modifiers) == 0) {
1646 if (keyData == Keys.Enter) {
1647 IntPtr window = XplatUI.GetFocus ();
1648 Control c = Control.FromHandle (window);
1649 if (c is Button && c.FindForm () == this) {
1650 ((Button)c).PerformClick ();
1653 else if (accept_button != null) {
1654 accept_button.PerformClick();
1657 } else if (keyData == Keys.Escape && cancel_button != null) {
1658 cancel_button.PerformClick();
1662 return base.ProcessDialogKey(keyData);
1665 protected override bool ProcessKeyPreview(ref Message msg) {
1667 if (ProcessKeyEventArgs(ref msg)) {
1671 return base.ProcessKeyPreview (ref msg);
1674 protected override bool ProcessTabKey(bool forward) {
1675 return SelectNextControl(ActiveControl, forward, true, true, true);
1678 [EditorBrowsable(EditorBrowsableState.Advanced)]
1679 protected override void ScaleCore(float dx, float dy) {
1683 // We can't scale max or min windows
1684 if (WindowState == FormWindowState.Normal) {
1685 // We cannot call base since base also adjusts X/Y, but
1686 // a form is toplevel and doesn't move
1690 if (!GetStyle(ControlStyles.FixedWidth)) {
1691 size.Width = (int)(size.Width * dx);
1694 if (!GetStyle(ControlStyles.FixedHeight)) {
1695 size.Height = (int)(size.Height * dy);
1701 /* Now scale our children */
1702 Control [] controls = child_controls.GetAllControls ();
1703 for (int i=0; i < controls.Length; i++) {
1704 controls[i].Scale(dx, dy);
1713 protected override void Select(bool directed, bool forward) {
1717 base.SelectNextControl(null, forward, true, true, true);
1720 parent = this.ParentForm;
1721 if (parent != null) {
1722 parent.ActiveControl = this;
1728 [EditorBrowsable(EditorBrowsableState.Advanced)]
1729 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
1730 base.SetBoundsCore (x, y, width, height, specified);
1733 [EditorBrowsable(EditorBrowsableState.Advanced)]
1734 protected override void SetClientSizeCore(int x, int y) {
1735 if ((minimum_size.Width != 0) && (x < minimum_size.Width)) {
1736 x = minimum_size.Width;
1737 } else if ((maximum_size.Width != 0) && (x > maximum_size.Width)) {
1738 x = maximum_size.Width;
1741 if ((minimum_size.Height != 0) && (y < minimum_size.Height)) {
1742 y = minimum_size.Height;
1743 } else if ((maximum_size.Height != 0) && (y > maximum_size.Height)) {
1744 y = maximum_size.Height;
1747 Rectangle ClientRect = new Rectangle(0, 0, x, y);
1748 Rectangle WindowRect;
1749 CreateParams cp = this.CreateParams;
1751 clientsize_set = new Size(x, y);
1753 if (XplatUI.CalculateWindowRect(ref ClientRect, cp.Style, cp.ExStyle, cp.menu, out WindowRect)) {
1754 SetBounds(bounds.X, bounds.Y, WindowRect.Width, WindowRect.Height, BoundsSpecified.Size);
1758 [EditorBrowsable(EditorBrowsableState.Advanced)]
1759 protected override void SetVisibleCore(bool value) {
1760 base.SetVisibleCore (value);
1763 protected override void UpdateDefaultButton() {
1764 base.UpdateDefaultButton ();
1767 [EditorBrowsable(EditorBrowsableState.Advanced)]
1768 protected override void WndProc(ref Message m) {
1770 if (window_manager != null && window_manager.HandleMessage (ref m)) {
1774 switch((Msg)m.Msg) {
1775 case Msg.WM_DESTROY: {
1776 base.WndProc(ref m);
1777 if (!is_recreating) {
1778 this.closing = true;
1783 case Msg.WM_CLOSE_INTERNAL: {
1788 case Msg.WM_CLOSE: {
1789 Form act = Form.ActiveForm;
1790 if (act != null && act != this && act.Modal == true) {
1794 CancelEventArgs args = new CancelEventArgs ();
1796 if (mdi_container != null) {
1797 foreach (Form mdi_child in mdi_container.MdiChildren) {
1798 mdi_child.OnClosing (args);
1805 OnClosed (EventArgs.Empty);
1812 DialogResult = DialogResult.None;
1815 OnClosed (EventArgs.Empty);
1824 case Msg.WM_WINDOWPOSCHANGED: {
1825 if (WindowState != FormWindowState.Minimized) {
1826 base.WndProc(ref m);
1832 case Msg.WM_SYSCOMMAND: {
1833 // Let *Strips know the app's title bar was clicked
1834 if (XplatUI.IsEnabled (Handle))
1835 ToolStripMenuTracker.FireAppClicked ();
1837 base.WndProc(ref m);
1842 case Msg.WM_ACTIVATE: {
1843 if (m.WParam != (IntPtr)WindowActiveFlags.WA_INACTIVE) {
1844 OnActivated(EventArgs.Empty);
1846 OnDeactivate(EventArgs.Empty);
1848 // Let *Strips know the app lost focus
1849 if (XplatUI.IsEnabled (Handle))
1850 ToolStripMenuTracker.FireAppFocusChanged ();
1856 case Msg.WM_KILLFOCUS: {
1857 base.WndProc(ref m);
1861 case Msg.WM_SETFOCUS: {
1862 if (ActiveControl != null && ActiveControl != this) {
1863 ActiveControl.Focus();
1864 return; // FIXME - do we need to run base.WndProc, even though we just changed focus?
1866 base.WndProc(ref m);
1871 case Msg.WM_NCLBUTTONDOWN: {
1872 if (XplatUI.IsEnabled (Handle) && ActiveMenu != null) {
1873 ActiveMenu.OnMouseDown(this, new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()), mouse_clicks, Control.MousePosition.X, Control.MousePosition.Y, 0));
1876 if (ActiveMaximizedMdiChild != null) {
1877 ActiveMaximizedMdiChild.HandleMenuMouseDown (ActiveMenu,
1878 LowOrder ((int) m.LParam.ToInt32 ()),
1879 HighOrder ((int) m.LParam.ToInt32 ()));
1881 base.WndProc(ref m);
1885 case Msg.WM_NCMOUSEMOVE: {
1886 if (XplatUI.IsEnabled (Handle) && ActiveMenu != null) {
1887 ActiveMenu.OnMouseMove(this, new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()), mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()), 0));
1889 base.WndProc(ref m);
1893 case Msg.WM_NCPAINT: {
1894 if (ActiveMenu != null) {
1898 pe = XplatUI.PaintEventStart(Handle, false);
1899 pnt = XplatUI.GetMenuOrigin(window.Handle);
1901 // The entire menu has to be in the clip rectangle because the
1902 // control buttons are right-aligned and otherwise they would
1903 // stay painted when the window gets resized.
1904 Rectangle clip = new Rectangle (pnt.X, pnt.Y, ClientSize.Width, 0);
1905 clip = Rectangle.Union(clip, pe.ClipRectangle);
1907 pe.Graphics.SetClip(clip);
1909 ActiveMenu.Draw (pe, new Rectangle (pnt.X, pnt.Y, ClientSize.Width, 0));
1911 if (ActiveMaximizedMdiChild != null) {
1912 ActiveMaximizedMdiChild.DrawMaximizedButtons (ActiveMenu, pe);
1915 XplatUI.PaintEventEnd(Handle, false);
1918 base.WndProc(ref m);
1922 case Msg.WM_NCCALCSIZE: {
1923 XplatUIWin32.NCCALCSIZE_PARAMS ncp;
1925 if ((ActiveMenu != null) && (m.WParam == (IntPtr)1)) {
1926 ncp = (XplatUIWin32.NCCALCSIZE_PARAMS)Marshal.PtrToStructure(m.LParam, typeof(XplatUIWin32.NCCALCSIZE_PARAMS));
1929 ncp.rgrc1.top += ThemeEngine.Current.CalcMenuBarSize (DeviceContext, ActiveMenu, ncp.rgrc1.right - ncp.rgrc1.left);
1930 Marshal.StructureToPtr(ncp, m.LParam, true);
1936 case Msg.WM_MOUSEMOVE: {
1937 if (XplatUI.IsEnabled (Handle) && active_tracker != null) {
1938 MouseEventArgs args;
1940 args = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
1941 mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()), 0);
1942 active_tracker.OnMotion(new MouseEventArgs (args.Button, args.Clicks, Control.MousePosition.X, Control.MousePosition.Y, args.Delta));
1945 base.WndProc(ref m);
1949 case Msg.WM_LBUTTONDOWN:
1950 case Msg.WM_MBUTTONDOWN:
1951 case Msg.WM_RBUTTONDOWN: {
1952 if (XplatUI.IsEnabled (Handle) && active_tracker != null) {
1953 MouseEventArgs args;
1955 args = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
1956 mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()), 0);
1957 active_tracker.OnMouseDown(new MouseEventArgs (args.Button, args.Clicks, Control.MousePosition.X, Control.MousePosition.Y, args.Delta));
1960 base.WndProc(ref m);
1964 case Msg.WM_LBUTTONUP:
1965 case Msg.WM_MBUTTONUP:
1966 case Msg.WM_RBUTTONUP: {
1967 if (XplatUI.IsEnabled (Handle) && active_tracker != null) {
1968 MouseEventArgs args;
1969 MouseButtons mb = FromParamToMouseButtons ((int) m.WParam.ToInt32());
1971 // We add in the button that was released (not sent in WParam)
1972 switch((Msg)m.Msg) {
1973 case Msg.WM_LBUTTONUP:
1974 mb |= MouseButtons.Left;
1976 case Msg.WM_MBUTTONUP:
1977 mb |= MouseButtons.Middle;
1979 case Msg.WM_RBUTTONUP:
1980 mb |= MouseButtons.Right;
1984 args = new MouseEventArgs (mb, mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()), 0);
1985 active_tracker.OnMouseUp(new MouseEventArgs (args.Button, args.Clicks, Control.MousePosition.X, Control.MousePosition.Y, args.Delta));
1989 base.WndProc(ref m);
1993 case Msg.WM_GETMINMAXINFO: {
1996 if (m.LParam != IntPtr.Zero) {
1997 mmi = (MINMAXINFO)Marshal.PtrToStructure(m.LParam, typeof(MINMAXINFO));
1999 default_maximized_bounds = new Rectangle(mmi.ptMaxPosition.x, mmi.ptMaxPosition.y, mmi.ptMaxSize.x, mmi.ptMaxSize.y);
2000 if (maximized_bounds != Rectangle.Empty) {
2001 mmi.ptMaxPosition.x = maximized_bounds.Left;
2002 mmi.ptMaxPosition.y = maximized_bounds.Top;
2003 mmi.ptMaxSize.x = maximized_bounds.Width;
2004 mmi.ptMaxSize.y = maximized_bounds.Height;
2007 if (minimum_size != Size.Empty) {
2008 mmi.ptMinTrackSize.x = minimum_size.Width;
2009 mmi.ptMinTrackSize.y = minimum_size.Height;
2012 if (maximum_size != Size.Empty) {
2013 mmi.ptMaxTrackSize.x = maximum_size.Width;
2014 mmi.ptMaxTrackSize.y = maximum_size.Height;
2016 Marshal.StructureToPtr(mmi, m.LParam, false);
2022 case Msg.WM_MOUSEACTIVATE: {
2023 // Let *Strips know the form or another control has been clicked
2024 if (XplatUI.IsEnabled (Handle))
2025 ToolStripMenuTracker.FireAppClicked ();
2027 base.WndProc (ref m);
2033 base.WndProc (ref m);
2038 #endregion // Protected Instance Methods
2040 internal void RemoveWindowManager ()
2042 window_manager = null;
2045 internal override void CheckAcceptButton()
2047 if (accept_button != null) {
2048 Button a_button = accept_button as Button;
2050 if (ActiveControl == a_button)
2053 if (ActiveControl is Button) {
2054 a_button.paint_as_acceptbutton = false;
2058 a_button.paint_as_acceptbutton = true;
2065 public event EventHandler Activated;
2066 public event EventHandler Closed;
2067 public event CancelEventHandler Closing;
2068 public event EventHandler Deactivate;
2069 public event InputLanguageChangedEventHandler InputLanguageChanged;
2070 public event InputLanguageChangingEventHandler InputLanguageChanging;
2071 public event EventHandler Load;
2072 public event EventHandler MaximizedBoundsChanged;
2073 public event EventHandler MaximumSizeChanged;
2074 public event EventHandler MdiChildActivate;
2075 public event EventHandler MenuComplete;
2076 public event EventHandler MenuStart;
2077 public event EventHandler MinimumSizeChanged;
2080 [EditorBrowsable(EditorBrowsableState.Never)]
2081 public new event EventHandler TabIndexChanged {
2082 add { base.TabIndexChanged += value; }
2083 remove { base.TabIndexChanged -= value; }
2085 #endregion // Events