示例#1
0
        internal void SendFocusToActiveChild()
        {
            Form active = this.ActiveMdiChild;

            if (active == null)
            {
                ParentForm.SendControlFocus(this);
            }
            else
            {
                active.SendControlFocus(active);
                ParentForm.ActiveControl = active;
            }
        }
示例#2
0
        internal void ActivateChild(Form form)
        {
            if (Controls.Count < 1)
            {
                return;
            }

            if (ParentForm.is_changing_visible_state > 0)
            {
                return;
            }

            Form current          = (Form)Controls [0];
            bool raise_deactivate = ParentForm.ActiveControl == current;

            // We want to resize the new active form before it is
            // made active to avoid flickering. Can't do it in the
            // normal way (form.WindowState = Maximized) since it's not
            // active yet and everything would just return to before.
            // We also won't suspend layout, this way the layout will
            // happen before the form is made active (and in many cases
            // before it is visible, which avoids flickering as well).
            MdiWindowManager wm = (MdiWindowManager)form.WindowManager;

            if (current.WindowState == FormWindowState.Maximized && form.WindowState != FormWindowState.Maximized && form.Visible)
            {
                FormWindowState old_state = form.window_state;
                SetWindowState(form, old_state, FormWindowState.Maximized, true);
                wm.was_minimized  = form.window_state == FormWindowState.Minimized;
                form.window_state = FormWindowState.Maximized;
                SetParentText(false);
            }

            form.BringToFront();
            form.SendControlFocus(form);
            SetWindowStates(wm);
            if (current != form)
            {
                form.has_focus = false;
                if (current.IsHandleCreated)
                {
                    XplatUI.InvalidateNC(current.Handle);
                }
                if (form.IsHandleCreated)
                {
                    XplatUI.InvalidateNC(form.Handle);
                }
                if (raise_deactivate)
                {
                    MdiWindowManager current_wm = (MdiWindowManager)current.window_manager;
                    current_wm.RaiseDeactivate();
                }
            }
            active_child = (Form)Controls [0];

            if (active_child.Visible)
            {
                bool raise_activated = ParentForm.ActiveControl != active_child;
                ParentForm.ActiveControl = active_child;
                if (raise_activated)
                {
                    MdiWindowManager active_wm = (MdiWindowManager)active_child.window_manager;
                    active_wm.RaiseActivated();
                }
            }
        }
		internal void ActivateChild (Form form)
		{
			if (Controls.Count < 1)
				return;

			if (ParentForm.is_changing_visible_state > 0)
				return;
			
			Form current = (Form) Controls [0];
			bool raise_deactivate = ParentForm.ActiveControl == current;

			// We want to resize the new active form before it is 
			// made active to avoid flickering. Can't do it in the
			// normal way (form.WindowState = Maximized) since it's not
			// active yet and everything would just return to before. 
			// We also won't suspend layout, this way the layout will
			// happen before the form is made active (and in many cases
			// before it is visible, which avoids flickering as well).
			MdiWindowManager wm = (MdiWindowManager)form.WindowManager;
			
			if (current.WindowState == FormWindowState.Maximized && form.WindowState != FormWindowState.Maximized && form.Visible) {
				FormWindowState old_state = form.window_state;
				SetWindowState (form, old_state, FormWindowState.Maximized, true);
				wm.was_minimized = form.window_state == FormWindowState.Minimized;
				form.window_state = FormWindowState.Maximized;
				SetParentText (false);
			}

			form.BringToFront ();
			form.SendControlFocus (form);
			SetWindowStates (wm);
			if (current != form) {
				form.has_focus = false;
				if (current.IsHandleCreated)
					XplatUI.InvalidateNC (current.Handle);
				if (form.IsHandleCreated)
					XplatUI.InvalidateNC (form.Handle);
				if (raise_deactivate) {
					MdiWindowManager current_wm = (MdiWindowManager) current.window_manager;
					current_wm.RaiseDeactivate ();
					
				}
			}
			active_child = (Form) Controls [0];
			
			if (active_child.Visible) {
				bool raise_activated = ParentForm.ActiveControl != active_child;
				ParentForm.ActiveControl = active_child;
				if (raise_activated) {
					MdiWindowManager active_wm = (MdiWindowManager) active_child.window_manager;
					active_wm.RaiseActivated ();
				}
			}
		}