Ejemplo n.º 1
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            _dragTab = null;

            if (_tabArea.DropdownRectangle.Contains(e.Location))
            {
                if (_tabArea.DropdownHot)
                {
                    _tabArea.ShowMenu(this, new Point(_tabArea.DropdownRectangle.Left, _tabArea.DropdownRectangle.Bottom - 2));
                }

                return;
            }

            if (_tabArea.ClickedCloseButton == null)
            {
                return;
            }

            var closeRect = RectangleToTabArea(_tabArea.ClickedCloseButton.CloseButtonRectangle);

            if (closeRect.Contains(e.Location))
            {
                _tabArea.ClickedCloseButton.DockContent.Close();
            }
        }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (_tabArea.DropdownRectangle.Contains(e.Location))
            {
                _tabArea.DropdownHot = true;
                return;
            }

            foreach (var tab in _tabs.Values)
            {
                var rect = RectangleToTabArea(tab.ClientRectangle);
                if (rect.Contains(e.Location))
                {
                    if (e.Button == MouseButtons.Middle)
                    {
                        if (this.DockPanel.CloseButtonEnabled)
                        {
                            tab.DockContent.Close();
                        }
                        return;
                    }

                    var closeRect = RectangleToTabArea(tab.CloseButtonRectangle);
                    if (this.DockPanel.CloseButtonEnabled && closeRect.Contains(e.Location))
                    {
                        _tabArea.ClickedCloseButton = tab;
                        return;
                    }
                    else
                    {
                        DockPanel.ActiveContent = tab.DockContent;
                        EnsureVisible();

                        _dragTab = tab;

                        return;
                    }
                }
            }

            if (VisibleContent != null)
            {
                DockPanel.ActiveContent = VisibleContent;
            }
        }
Ejemplo n.º 3
0
        private void PaintToolWindowTab(Graphics g, DarkDockTab tab)
        {
            var tabRect = tab.ClientRectangle;

            var isVisibleTab = VisibleContent == tab.DockContent;

            var bgColor = isVisibleTab ? Colors.GreyBackground : Colors.DarkBackground;

            if (tab.Hot && !isVisibleTab)
            {
                bgColor = Colors.MediumBackground;
            }

            using (var b = new SolidBrush(bgColor))
            {
                g.FillRectangle(b, tabRect);
            }

            // Draw separators
            if (tab.ShowSeparator)
            {
                using (var p = new Pen(Colors.DarkBorder))
                {
                    g.DrawLine(p, tabRect.Right - 1, tabRect.Top, tabRect.Right - 1, tabRect.Bottom);
                }
            }

            var tabTextFormat = new StringFormat
            {
                Alignment     = StringAlignment.Near,
                LineAlignment = StringAlignment.Center,
                FormatFlags   = StringFormatFlags.NoWrap,
                Trimming      = StringTrimming.EllipsisCharacter
            };

            var textColor = isVisibleTab ? Colors.BlueHighlight : Colors.DisabledText;

            using (var b = new SolidBrush(textColor))
            {
                var textRect = new Rectangle(tabRect.Left + 5, tabRect.Top, tabRect.Width - 5, tabRect.Height);
                g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat);
            }
        }
Ejemplo n.º 4
0
        private void PaintDocumentTab(Graphics g, DarkDockTab tab)
        {
            var tabRect = RectangleToTabArea(tab.ClientRectangle);

            var isVisibleTab  = VisibleContent == tab.DockContent;
            var isActiveGroup = DockPanel.ActiveGroup == this;

            var bgColor = isVisibleTab ? Colors.BlueSelection : Colors.DarkBackground;

            if (!isActiveGroup)
            {
                bgColor = isVisibleTab ? Colors.GreySelection : Colors.DarkBackground;
            }

            if (tab.Hot && !isVisibleTab)
            {
                bgColor = Colors.MediumBackground;
            }

            using (var b = new SolidBrush(bgColor))
            {
                g.FillRectangle(b, tabRect);
            }

            // Draw separators
            if (tab.ShowSeparator)
            {
                using (var p = new Pen(Colors.DarkBorder))
                {
                    g.DrawLine(p, tabRect.Right - 1, tabRect.Top, tabRect.Right - 1, tabRect.Bottom);
                }
            }

            var xOffset = 0;

            // Draw icon
            if (tab.DockContent.Icon != null)
            {
                g.DrawImage(tab.DockContent.Icon, tabRect.Left + 5, tabRect.Top + 4);
                xOffset += tab.DockContent.Icon.Width + 2;
            }

            var tabTextFormat = new StringFormat
            {
                Alignment     = StringAlignment.Near,
                LineAlignment = StringAlignment.Center,
                FormatFlags   = StringFormatFlags.NoWrap,
                Trimming      = StringTrimming.EllipsisCharacter
            };

            // Draw text
            var textColor = isVisibleTab ? Colors.LightText : Colors.DisabledText;

            using (var b = new SolidBrush(textColor))
            {
                var textRect = new Rectangle(tabRect.Left + 5 + xOffset, tabRect.Top, tabRect.Width - tab.CloseButtonRectangle.Width - 7 - 5 - xOffset, tabRect.Height);
                g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat);
            }

            // Close button
            var img = tab.CloseButtonHot ? DockIcons.inactive_close_selected : DockIcons.inactive_close;

            if (isVisibleTab)
            {
                if (isActiveGroup)
                {
                    img = tab.CloseButtonHot ? DockIcons.close_selected : DockIcons.close;
                }
                else
                {
                    img = tab.CloseButtonHot ? DockIcons.close_selected : DockIcons.active_inactive_close;
                }
            }

            var closeRect = RectangleToTabArea(tab.CloseButtonRectangle);

            g.DrawImage(img, closeRect.Left, closeRect.Top);
        }
Ejemplo n.º 5
0
        private void PaintToolWindowTab(Graphics g, DarkDockTab tab)
        {
            var tabRect = tab.ClientRectangle;

            var isVisibleTab = VisibleContent == tab.DockContent;

            var bgColor = isVisibleTab ? Colors.GreyBackground : Colors.DarkBackground;

            if (tab.Hot && !isVisibleTab)
                bgColor = Colors.MediumBackground;

            using (var b = new SolidBrush(bgColor))
            {
                g.FillRectangle(b, tabRect);
            }

            // Draw separators
            if (tab.ShowSeparator)
            {
                using (var p = new Pen(Colors.DarkBorder))
                {
                    g.DrawLine(p, tabRect.Right - 1, tabRect.Top, tabRect.Right - 1, tabRect.Bottom);
                }
            }

            var tabTextFormat = new StringFormat
            {
                Alignment = StringAlignment.Near,
                LineAlignment = StringAlignment.Center,
                FormatFlags = StringFormatFlags.NoWrap,
                Trimming = StringTrimming.EllipsisCharacter
            };

            var textColor = isVisibleTab ? Colors.BlueHighlight : Colors.DisabledText;
            using (var b = new SolidBrush(textColor))
            {
                var textRect = new Rectangle(tabRect.Left + 5, tabRect.Top, tabRect.Width - 5, tabRect.Height);
                g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat);
            }
        }
Ejemplo n.º 6
0
        private void PaintDocumentTab(Graphics g, DarkDockTab tab)
        {
            var tabRect = RectangleToTabArea(tab.ClientRectangle);

            var isVisibleTab = VisibleContent == tab.DockContent;
            var isActiveGroup = DockPanel.ActiveGroup == this;

            var bgColor = isVisibleTab ? Colors.BlueSelection : Colors.DarkBackground;

            if (!isActiveGroup)
                bgColor = isVisibleTab ? Colors.GreySelection : Colors.DarkBackground;

            if (tab.Hot && !isVisibleTab)
                bgColor = Colors.MediumBackground;

            using (var b = new SolidBrush(bgColor))
            {
                g.FillRectangle(b, tabRect);
            }

            // Draw separators
            if (tab.ShowSeparator)
            {
                using (var p = new Pen(Colors.DarkBorder))
                {
                    g.DrawLine(p, tabRect.Right - 1, tabRect.Top, tabRect.Right - 1, tabRect.Bottom);
                }
            }

            var xOffset = 0;

            // Draw icon
            if (tab.DockContent.Icon != null)
            {
                g.DrawImageUnscaled(tab.DockContent.Icon, tabRect.Left + 5, tabRect.Top + 4);
                xOffset += tab.DockContent.Icon.Width + 2;
            }

            var tabTextFormat = new StringFormat
            {
                Alignment = StringAlignment.Near,
                LineAlignment = StringAlignment.Center,
                FormatFlags = StringFormatFlags.NoWrap,
                Trimming = StringTrimming.EllipsisCharacter
            };

            // Draw text
            var textColor = isVisibleTab ? Colors.LightText : Colors.DisabledText;
            using (var b = new SolidBrush(textColor))
            {
                var textRect = new Rectangle(tabRect.Left + 5 + xOffset, tabRect.Top, tabRect.Width - tab.CloseButtonRectangle.Width - 7 - 5 - xOffset, tabRect.Height);
                g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat);
            }

            // Close button
            var img = tab.CloseButtonHot ? DockIcons.inactive_close_selected : DockIcons.inactive_close;

            if (isVisibleTab)
            {
                if (isActiveGroup)
                    img = tab.CloseButtonHot ? DockIcons.close_selected : DockIcons.close;
                else
                    img = tab.CloseButtonHot ? DockIcons.close_selected : DockIcons.active_inactive_close;
            }

            var closeRect = RectangleToTabArea(tab.CloseButtonRectangle);
            g.DrawImageUnscaled(img, closeRect.Left, closeRect.Top);
        }
Ejemplo n.º 7
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            _dragTab = null;

            if (_tabArea.DropdownRectangle.Contains(e.Location))
            {
                if (_tabArea.DropdownHot)
                    _tabArea.ShowMenu(this, new Point(_tabArea.DropdownRectangle.Left, _tabArea.DropdownRectangle.Bottom - 2));

                return;
            }

            if (_tabArea.ClickedCloseButton == null)
                return;

            var closeRect = RectangleToTabArea(_tabArea.ClickedCloseButton.CloseButtonRectangle);
            if (closeRect.Contains(e.Location))
                _tabArea.ClickedCloseButton.DockContent.Close();
        }
Ejemplo n.º 8
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (_tabArea.DropdownRectangle.Contains(e.Location))
            {
                _tabArea.DropdownHot = true;
                return;
            }

            foreach (var tab in _tabs.Values)
            {
                var rect = RectangleToTabArea(tab.ClientRectangle);
                if (rect.Contains(e.Location))
                {
                    if (e.Button == MouseButtons.Middle)
                    {
                        tab.DockContent.Close();
                        return;
                    }

                    var closeRect = RectangleToTabArea(tab.CloseButtonRectangle);
                    if (closeRect.Contains(e.Location))
                    {
                        _tabArea.ClickedCloseButton = tab;
                        return;
                    }
                    else
                    {
                        DockPanel.ActiveContent = tab.DockContent;
                        EnsureVisible();

                        _dragTab = tab;
   
                        return;
                    }
                }
            }

            if (VisibleContent != null)
                DockPanel.ActiveContent = VisibleContent;
        }