Exemple #1
0
 /// <summary>
 /// Raises PrepareModalPanelBounds event.
 /// </summary>
 /// <param name="e">Provides event arguments.</param>
 protected virtual void OnPrepareModalPanelBounds(ModalPanelBoundsEventArgs e)
 {
     ModalPanelBoundsEventHandler handler = PrepareModalPanelBounds;
     if (handler != null)
         handler(this, e);
 }
Exemple #2
0
        private Rectangle GetModalPanelBounds()
        {
            Thickness borderThickness = GetBorderThickness();

            int statusBarHeight = 0;
            if (_ModalPanelBoundsExcludeStatusBar)
            {
                foreach (Control item in this.Controls)
                {
                    if (item is MetroStatusBar && item.Dock == DockStyle.Bottom)
                    {
                        statusBarHeight = item.Height;
                        break;
                    }
                }
            }

            Rectangle bounds = Rectangle.Empty;
            if (_MetroTab != null && _MetroTab.CaptionVisible)
            {
                int captionHeight = _MetroTab.MetroTabStrip.GetCaptionHeight() + 2;
                bounds = new Rectangle((int)borderThickness.Left, captionHeight, this.Width - (int)borderThickness.Horizontal, this.Height - captionHeight - (int)borderThickness.Bottom - statusBarHeight);
            }
            else
            {
                bounds = new Rectangle((int)borderThickness.Left, (int)borderThickness.Top, this.Width - (int)borderThickness.Horizontal, this.Height - (int)borderThickness.Vertical - statusBarHeight);
            }

            ModalPanelBoundsEventArgs args = new ModalPanelBoundsEventArgs(bounds);
            OnPrepareModalPanelBounds(args);
            bounds = args.ModalPanelBounds;

            return bounds;
        }