SetWindowLong() private method

private SetWindowLong ( IntPtr hwnd, int nIndex, uint nLong ) : uint
hwnd IntPtr
nIndex int
nLong uint
return uint
コード例 #1
0
        private void OnRibbonMdiChildActivate(object sender, EventArgs e)
        {
            // Cast to correct type
            Form topForm = sender as Form;

            // Unhook from watching any previous mdi child
            if (_activeMdiChild != null)
            {
                _activeMdiChild.SizeChanged -= new EventHandler(OnRibbonMdiChildSizeChanged);
            }

            _activeMdiChild = topForm.ActiveMdiChild;

            // Start watching any new mdi child
            if (_activeMdiChild != null)
            {
                _activeMdiChild.SizeChanged += new EventHandler(OnRibbonMdiChildSizeChanged);
            }

            // Update the pendant buttons with reference to new child
            _buttonSpecClose.MdiChild   = _activeMdiChild;
            _buttonSpecRestore.MdiChild = _activeMdiChild;
            _buttonSpecMin.MdiChild     = _activeMdiChild;
            _buttonManager.RecreateButtons();
            PerformNeedPaint(true);

            // We never want the mdi child window to have a system menu, we provide the
            // pendant buttons as part of the ribbon and so replace the need for it.
            PI.SetMenu(new HandleRef(_ribbon, topForm.Handle), NullHandleRef);

            if (_activeMdiChild != null)
            {
                uint windowStyle = PI.GetWindowLong(_activeMdiChild.Handle, -16);
                windowStyle |= PI.WS_SYSMENU;
                PI.SetWindowLong(_activeMdiChild.Handle, -16, windowStyle);
            }
        }