Esempio n. 1
0
        private Rectangle GetTabRectangle(TabVS2003 tab, bool transformed)
        {
            DockState dockState    = tab.Content.DockHandler.DockState;
            Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);

            if (rectTabStrip.IsEmpty)
            {
                return(Rectangle.Empty);
            }

            int x = tab.TabX;
            int y = rectTabStrip.Y +
                    (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide ?
                     0 : TabGapTop);
            int width  = tab.TabWidth;
            int height = rectTabStrip.Height - TabGapTop;

            if (!transformed)
            {
                return(new Rectangle(x, y, width, height));
            }
            else
            {
                return(GetTransformedRectangle(dockState, new Rectangle(x, y, width, height)));
            }
        }
        private Rectangle GetTabRectangle_Document(int index)
        {
            Rectangle rectTabStrip = ClientRectangle;
            TabVS2003 tab          = (TabVS2003)Tabs[index];

            return(new Rectangle(tab.TabX, rectTabStrip.Y + DocumentTabGapTop, tab.TabWidth, rectTabStrip.Height - DocumentTabGapTop));
        }
        private Rectangle GetTabRectangle_ToolWindow(int index)
        {
            Rectangle rectTabStrip = ClientRectangle;

            TabVS2003 tab = (TabVS2003)(Tabs[index]);

            return(new Rectangle(tab.TabX, rectTabStrip.Y, tab.TabWidth, rectTabStrip.Height));
        }
        private void DrawTab(Graphics g, TabVS2003 tab, Rectangle rect)
        {
            OnBeginDrawTab(tab);

            if (Appearance == DockPane.AppearanceStyle.ToolWindow)
            {
                DrawTab_ToolWindow(g, tab, rect);
            }
            else
            {
                DrawTab_Document(g, tab, rect);
            }

            OnEndDrawTab(tab);
        }
Esempio n. 5
0
        private void DrawTab_ToolWindow(Graphics g, TabVS2003 tab, Rectangle rect)
        {
            Rectangle rectIcon = new Rectangle(
                rect.X + ToolWindowImageGapLeft,
                rect.Y + rect.Height - 1 - ToolWindowImageGapBottom - ToolWindowImageHeight,
                ToolWindowImageWidth, ToolWindowImageHeight);
            Rectangle rectText = rectIcon;

            rectText.X    += rectIcon.Width + ToolWindowImageGapRight;
            rectText.Width = rect.Width - rectIcon.Width - ToolWindowImageGapLeft -
                             ToolWindowImageGapRight - ToolWindowTextGapRight;

            if (DockPane.ActiveContent == tab.Content)
            {
                g.FillRectangle(ActiveBackBrush, rect);
                g.DrawLine(OutlineOuterPen,
                           rect.X, rect.Y, rect.X, rect.Y + rect.Height - 1);
                g.DrawLine(OutlineInnerPen,
                           rect.X, rect.Y + rect.Height - 1, rect.X + rect.Width - 1, rect.Y + rect.Height - 1);
                g.DrawLine(OutlineInnerPen,
                           rect.X + rect.Width - 1, rect.Y, rect.X + rect.Width - 1, rect.Y + rect.Height - 1);
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, ActiveTextColor,
                                      ToolWindowTextFormat);
            }
            else
            {
                if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(tab) + 1)
                {
                    g.DrawLine(TabSeperatorPen,
                               rect.X + rect.Width - 1,
                               rect.Y + ToolWindowTabSeperatorGapTop,
                               rect.X + rect.Width - 1,
                               rect.Y + rect.Height - 1 - ToolWindowTabSeperatorGapBottom);
                }
                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, InactiveTextColor,
                                      ToolWindowTextFormat);
            }

            if (rect.Contains(rectIcon))
            {
                g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);
            }
        }
        private Rectangle GetTabRectangle(TabVS2003 tab, bool transformed)
        {
            DockState dockState = tab.Content.DockHandler.DockState;
            Rectangle rectTabStrip = GetLogicalTabStripRectangle(dockState);

            if (rectTabStrip.IsEmpty)
                return Rectangle.Empty;

            int x = tab.TabX;
            int y = rectTabStrip.Y +
                (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide ?
                0 : TabGapTop);
            int width = tab.TabWidth;
            int height = rectTabStrip.Height - TabGapTop;

            if (!transformed)
                return new Rectangle(x, y, width, height);
            else
                return GetTransformedRectangle(dockState, new Rectangle(x, y, width, height));
        }
 private Rectangle GetTabRectangle(TabVS2003 tab)
 {
     return GetTabRectangle(tab, false);
 }
        private void DrawTab(Graphics g, TabVS2003 tab)
        {
            Rectangle rectTab = GetTabRectangle(tab);
            if (rectTab.IsEmpty)
                return;

            DockState dockState = tab.Content.DockHandler.DockState;
            IDockContent content = tab.Content;

            OnBeginDrawTab(tab);

            Brush brushTabBackGround = BrushTabBackground;
            Pen penTabBorder = PenTabBorder;
            Brush brushTabText = BrushTabText;

            g.FillRectangle(brushTabBackGround, rectTab);

            g.DrawLine(penTabBorder, rectTab.Left, rectTab.Top, rectTab.Left, rectTab.Bottom);
            g.DrawLine(penTabBorder, rectTab.Right, rectTab.Top, rectTab.Right, rectTab.Bottom);
            if (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide)
                g.DrawLine(penTabBorder, rectTab.Left, rectTab.Bottom, rectTab.Right, rectTab.Bottom);
            else
                g.DrawLine(penTabBorder, rectTab.Left, rectTab.Top, rectTab.Right, rectTab.Top);

            // Set no rotate for drawing icon and text
            Matrix matrixRotate = g.Transform;
            g.Transform = MatrixIdentity;

            // Draw the icon
            Rectangle rectImage = rectTab;
            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            int imageHeight = rectTab.Height - ImageGapTop - ImageGapBottom;
            int imageWidth = ImageWidth;
            if (imageHeight > ImageHeight)
                imageWidth = ImageWidth * (imageHeight/ImageHeight);
            rectImage.Height = imageHeight;
            rectImage.Width = imageWidth;
            rectImage = GetTransformedRectangle(dockState, rectImage);
            g.DrawIcon(((Form)content).Icon, rectImage);

            // Draw the text
            if (content == content.DockHandler.Pane.ActiveContent)
            {
                Rectangle rectText = rectTab;
                rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                rectText = GetTransformedRectangle(dockState, rectText);
                if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                    g.DrawString(content.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabVertical);
                else
                    g.DrawString(content.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabHorizontal);
            }

            // Set rotate back
            g.Transform = matrixRotate;

            OnEndDrawTab(tab);
        }
        private void DrawTab_Document(Graphics g, TabVS2003 tab, Rectangle rect)
        {
            Rectangle rectText = rect;

            if (DockPane.DockPanel.ShowDocumentIcon)
            {
                rectText.X     += DocumentIconWidth + DocumentIconGapLeft;
                rectText.Width -= DocumentIconWidth + DocumentIconGapLeft;
            }

            if (DockPane.ActiveContent == tab.Content)
            {
                g.FillRectangle(ActiveBackBrush, rect);
                g.DrawLine(OutlineOuterPen, rect.X, rect.Y, rect.X, rect.Y + rect.Height);
                g.DrawLine(OutlineOuterPen, rect.X, rect.Y, rect.X + rect.Width - 1, rect.Y);
                g.DrawLine(OutlineInnerPen,
                           rect.X + rect.Width - 1, rect.Y,
                           rect.X + rect.Width - 1, rect.Y + rect.Height - 1);

                if (DockPane.DockPanel.ShowDocumentIcon)
                {
                    Icon      icon     = (tab.Content as Form).Icon;
                    Rectangle rectIcon = new Rectangle(
                        rect.X + DocumentIconGapLeft,
                        rect.Y + (rect.Height - DocumentIconHeight) / 2,
                        DocumentIconWidth, DocumentIconHeight);

                    g.DrawIcon(tab.ContentForm.Icon, rectIcon);
                }

                if (DockPane.IsActiveDocumentPane)
                {
                    using (Font boldFont = new Font(this.Font, FontStyle.Bold))
                    {
                        TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, boldFont, rectText, ActiveTextColor, DocumentTextFormat);
                    }
                }
                else
                {
                    TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, InactiveTextColor, DocumentTextFormat);
                }
            }
            else
            {
                if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(tab) + 1)
                {
                    g.DrawLine(TabSeperatorPen,
                               rect.X + rect.Width - 1, rect.Y,
                               rect.X + rect.Width - 1, rect.Y + rect.Height - 1 - DocumentTabGapTop);
                }

                if (DockPane.DockPanel.ShowDocumentIcon)
                {
                    Icon      icon     = tab.ContentForm.Icon;
                    Rectangle rectIcon = new Rectangle(
                        rect.X + DocumentIconGapLeft,
                        rect.Y + (rect.Height - DocumentIconHeight) / 2,
                        DocumentIconWidth, DocumentIconHeight);

                    g.DrawIcon(tab.ContentForm.Icon, rectIcon);
                }

                TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, Font, rectText, InactiveTextColor, DocumentTextFormat);
            }
        }
Esempio n. 10
0
 private Rectangle GetTabRectangle(TabVS2003 tab)
 {
     return(GetTabRectangle(tab, false));
 }
Esempio n. 11
0
        private void DrawTab(Graphics g, TabVS2003 tab)
        {
            Rectangle rectTab = GetTabRectangle(tab);

            if (rectTab.IsEmpty)
            {
                return;
            }

            DockState    dockState = tab.Content.DockHandler.DockState;
            IDockContent content   = tab.Content;

            OnBeginDrawTab(tab);

            Brush brushTabBackGround = BrushTabBackground;
            Pen   penTabBorder       = PenTabBorder;
            Brush brushTabText       = BrushTabText;

            g.FillRectangle(brushTabBackGround, rectTab);

            g.DrawLine(penTabBorder, rectTab.Left, rectTab.Top, rectTab.Left, rectTab.Bottom);
            g.DrawLine(penTabBorder, rectTab.Right, rectTab.Top, rectTab.Right, rectTab.Bottom);
            if (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide)
            {
                g.DrawLine(penTabBorder, rectTab.Left, rectTab.Bottom, rectTab.Right, rectTab.Bottom);
            }
            else
            {
                g.DrawLine(penTabBorder, rectTab.Left, rectTab.Top, rectTab.Right, rectTab.Top);
            }

            // Set no rotate for drawing icon and text
            Matrix matrixRotate = g.Transform;

            g.Transform = MatrixIdentity;

            // Draw the icon
            Rectangle rectImage = rectTab;

            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            int imageHeight = rectTab.Height - ImageGapTop - ImageGapBottom;
            int imageWidth  = ImageWidth;

            if (imageHeight > ImageHeight)
            {
                imageWidth = ImageWidth * (imageHeight / ImageHeight);
            }
            rectImage.Height = imageHeight;
            rectImage.Width  = imageWidth;
            rectImage        = GetTransformedRectangle(dockState, rectImage);
            g.DrawIcon(((Form)content).Icon, rectImage);

            // Draw the text
            if (content == content.DockHandler.Pane.ActiveContent)
            {
                Rectangle rectText = rectTab;
                rectText.X     += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
                rectText        = GetTransformedRectangle(dockState, rectText);
                if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
                {
                    g.DrawString(content.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabVertical);
                }
                else
                {
                    g.DrawString(content.DockHandler.TabText, Font, brushTabText, rectText, StringFormatTabHorizontal);
                }
            }

            // Set rotate back
            g.Transform = matrixRotate;

            OnEndDrawTab(tab);
        }
Esempio n. 12
0
		private void DrawTab_Document( Graphics g, TabVS2003 tab, Rectangle rect ) {
			Rectangle rectText = rect;
			if( DockPane.DockPanel.ShowDocumentIcon ) {
				rectText.X += DocumentIconWidth + DocumentIconGapLeft;
				rectText.Width -= DocumentIconWidth + DocumentIconGapLeft;
			}

			if( DockPane.ActiveContent == tab.Content ) {
				g.FillRectangle( ActiveBackBrush, rect );
				g.DrawLine( OutlineOuterPen, rect.X, rect.Y, rect.X, rect.Y + rect.Height );
				g.DrawLine( OutlineOuterPen, rect.X, rect.Y, rect.X + rect.Width - 1, rect.Y );
				g.DrawLine( OutlineInnerPen,
					rect.X + rect.Width - 1, rect.Y,
					rect.X + rect.Width - 1, rect.Y + rect.Height - 1 );

				if( DockPane.DockPanel.ShowDocumentIcon ) {
					Icon icon = ( tab.Content as Form ).Icon;
					Rectangle rectIcon = new Rectangle(
						rect.X + DocumentIconGapLeft,
						rect.Y + ( rect.Height - DocumentIconHeight ) / 2,
						DocumentIconWidth, DocumentIconHeight );

					g.DrawIcon( tab.ContentForm.Icon, rectIcon );
				}

				if( DockPane.IsActiveDocumentPane ) {
					using( Font boldFont = new Font( this.Font, FontStyle.Bold ) ) {
						TextRenderer.DrawText( g, tab.Content.DockHandler.TabText, boldFont, rectText, ActiveTextColor, DocumentTextFormat );
					}
				} else
					TextRenderer.DrawText( g, tab.Content.DockHandler.TabText, Font, rectText, InactiveTextColor, DocumentTextFormat );
			} else {
				if( Tabs.IndexOf( DockPane.ActiveContent ) != Tabs.IndexOf( tab ) + 1 )
					g.DrawLine( TabSeperatorPen,
						rect.X + rect.Width - 1, rect.Y,
						rect.X + rect.Width - 1, rect.Y + rect.Height - 1 - DocumentTabGapTop );

				if( DockPane.DockPanel.ShowDocumentIcon ) {
					Icon icon = tab.ContentForm.Icon;
					Rectangle rectIcon = new Rectangle(
						rect.X + DocumentIconGapLeft,
						rect.Y + ( rect.Height - DocumentIconHeight ) / 2,
						DocumentIconWidth, DocumentIconHeight );

					g.DrawIcon( tab.ContentForm.Icon, rectIcon );
				}

				TextRenderer.DrawText( g, tab.Content.DockHandler.TabText, Font, rectText, InactiveTextColor, DocumentTextFormat );
			}
		}
Esempio n. 13
0
		private void DrawTab_ToolWindow( Graphics g, TabVS2003 tab, Rectangle rect ) {
			Rectangle rectIcon = new Rectangle(
				rect.X + ToolWindowImageGapLeft,
				rect.Y + rect.Height - 1 - ToolWindowImageGapBottom - ToolWindowImageHeight,
				ToolWindowImageWidth, ToolWindowImageHeight );
			Rectangle rectText = rectIcon;
			rectText.X += rectIcon.Width + ToolWindowImageGapRight;
			rectText.Width = rect.Width - rectIcon.Width - ToolWindowImageGapLeft -
				ToolWindowImageGapRight - ToolWindowTextGapRight;

			if( DockPane.ActiveContent == tab.Content ) {
				g.FillRectangle( ActiveBackBrush, rect );
				g.DrawLine( OutlineOuterPen,
					rect.X, rect.Y, rect.X, rect.Y + rect.Height - 1 );
				g.DrawLine( OutlineInnerPen,
					rect.X, rect.Y + rect.Height - 1, rect.X + rect.Width - 1, rect.Y + rect.Height - 1 );
				g.DrawLine( OutlineInnerPen,
					rect.X + rect.Width - 1, rect.Y, rect.X + rect.Width - 1, rect.Y + rect.Height - 1 );
				TextRenderer.DrawText( g, tab.Content.DockHandler.TabText, Font, rectText, ActiveTextColor, ToolWindowTextFormat );
			} else {
				if( Tabs.IndexOf( DockPane.ActiveContent ) != Tabs.IndexOf( tab ) + 1 )
					g.DrawLine( TabSeperatorPen,
						rect.X + rect.Width - 1,
						rect.Y + ToolWindowTabSeperatorGapTop,
						rect.X + rect.Width - 1,
						rect.Y + rect.Height - 1 - ToolWindowTabSeperatorGapBottom );
				TextRenderer.DrawText( g, tab.Content.DockHandler.TabText, Font, rectText, InactiveTextColor, ToolWindowTextFormat );
			}

			if( rect.Contains( rectIcon ) )
				g.DrawIcon( tab.Content.DockHandler.Icon, rectIcon );
		}
Esempio n. 14
0
		private void DrawTab( Graphics g, TabVS2003 tab, Rectangle rect ) {
			OnBeginDrawTab( tab );

			if( Appearance == DockPane.AppearanceStyle.ToolWindow )
				DrawTab_ToolWindow( g, tab, rect );
			else
				DrawTab_Document( g, tab, rect );

			OnEndDrawTab( tab );
		}