SetFocus() private méthode

private SetFocus ( IntPtr hWnd ) : IntPtr
hWnd IntPtr
Résultat IntPtr
Exemple #1
0
        /// <include file='CodeDoc\DockContentHandler.xml' path='//CodeDoc/Class[@name="DockContentHandler"]/Method[@name="Activate()"]/*'/>
        public void Activate()
        {
            if (DockPanel == null)
            {
                Form.Activate();
            }
            else if (Pane == null)
            {
                Show(DockPanel);
            }
            else
            {
                IsHidden           = false;
                Pane.ActiveContent = Content;
                if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyles.DockingMdi)
                {
                    Form.Activate();
                }
                else if (!Form.ContainsFocus)
                {
                    if (Contains(ActiveWindowHandle))
                    {
                        User32.SetFocus(ActiveWindowHandle);
                    }

                    if (!Form.ContainsFocus)
                    {
                        if (!Form.SelectNextControl(Form.ActiveControl, true, true, true, true))
                        {
                            // Since DockContent Form is not selectalbe, use Win32 SetFocus instead
                            User32.SetFocus(Form.Handle);
                        }
                    }
                }
            }
        }