Hide() публичный Метод

public Hide ( ) : void
Результат void
Пример #1
0
        /// <exclude/>
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDOWN)
            {
                if (IsDisposed)
                {
                    return;
                }

                uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result == 2 && DockPanel.AllowRedocking && this.AllowRedocking)                     // HITTEST_CAPTION
                {
                    Activate();
                    m_dockPanel.DragHandler.BeginDragFloatWindow(this);
                }
                else
                {
                    base.WndProc(ref m);
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_CLOSE)
            {
                if (DockList.Count == 0)
                {
                    base.WndProc(ref m);
                    return;
                }

                for (int i = DockList.Count - 1; i >= 0; i--)
                {
                    DockContentCollection contents = DockList[i].Contents;
                    for (int j = contents.Count - 1; j >= 0; j--)
                    {
                        DockContent content = contents[j];
                        if (content.DockState != DockState.Float)
                        {
                            continue;
                        }

                        if (!content.CloseButton)
                        {
                            continue;
                        }

                        if (content.HideOnClose)
                        {
                            content.Hide();
                        }
                        else
                        {
                            content.Close();
                        }
                    }
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK)
            {
                uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result != 2)                        // HITTEST_CAPTION
                {
                    base.WndProc(ref m);
                    return;
                }

                // Restore to panel
                DockContent activeContent = DockPanel.ActiveContent;
                foreach (DockPane pane in DockList)
                {
                    if (pane.DockState != DockState.Float)
                    {
                        continue;
                    }
                    pane.RestoreToPanel();
                }
                if (activeContent != null)
                {
                    activeContent.Activate();
                }

                return;
            }
            else if (m.Msg == WM_CHECKDISPOSE)
            {
                if (DockList.Count == 0)
                {
                    Dispose();
                }

                return;
            }

            base.WndProc(ref m);
        }
Пример #2
0
        internal void CloseContent(DockContent content)
        {
            if (content == null)
                return;

            if (!content.CloseButton)
                return;

            if (content.HideOnClose)
                content.Hide();
            else
            {
                //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                // Workaround for .Net Framework bug: removing control from Form may cause form
                // unclosable.
                //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                Form form = FindForm();
                if (ContainsFocus)
                {
                    if (form is FloatWindow)
                    {
                        ((FloatWindow)form).DummyControl.Focus();
                        form.ActiveControl = ((FloatWindow)form).DummyControl;
                    }
                    else if (DockPanel != null)
                    {
                        DockPanel.DummyControl.Focus();
                        if (form != null)
                            form.ActiveControl = DockPanel.DummyControl;
                    }
                }
                //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                content.Close();
            }
        }