Exemplo n.º 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 -= OnRibbonMdiChildSizeChanged;
            }

            _activeMdiChild = topForm.ActiveMdiChild;

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

            // Update the pendant buttons with reference to new child
            _buttonSpecClose.MdiChild = _activeMdiChild;
            _buttonSpecRestore.MdiChild = _activeMdiChild;
            _buttonSpecMin.MdiChild = _activeMdiChild;
            ButtonSpecManager.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, PI.GWL_.STYLE);
                windowStyle |= PI.WS_.SYSMENU;
                PI.SetWindowLong(_activeMdiChild.Handle, PI.GWL_.STYLE, windowStyle);
            }
        }
 /// <summary>
 /// Update the button spec manager mapping to reflect current settings.
 /// </summary>
 public override void UpdateButtonSpecMapping()
 {
     // Define a default mapping for text color and recreate to use that new setting
     ButtonSpecManager.SetRemapTarget(Navigator.Outlook.CheckButtonStyle);
     ButtonSpecManager.RecreateButtons();
 }
Exemplo n.º 3
0
 private void OnRibbonMdiChildSizeChanged(object sender, EventArgs e)
 {
     // Update pendant buttons to reflect new child state
     ButtonSpecManager.RecreateButtons();
     PerformNeedPaint(true);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Recreate the button specifications.
 /// </summary>
 public void RecreateButtons()
 {
     ButtonSpecManager?.RecreateButtons();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Update the button spec manager mapping to reflect current settings.
 /// </summary>
 public override void UpdateButtonSpecMapping()
 {
     // Update the button spec manager for this tab to use a tab style for remapping
     ButtonSpecManager.SetRemapTarget(Navigator.Bar.TabStyle);
     ButtonSpecManager.RecreateButtons();
 }