Exemple #1
0
        public override void Paint(Graphics g, TabStrip tabStrip)
        {
            base.Paint(g, tabStrip);

            TabColorScheme colorScheme = tabStrip.ColorScheme;
            Rectangle clientRect = tabStrip.DisplayRectangle;

            if (colorScheme.TabBackgroundImage != null)
                BarFunctions.PaintBackgroundImage(g, clientRect, colorScheme.TabBackgroundImage, eBackgroundImagePosition.Tile, 255);

            if (colorScheme.TabBackground != Color.Transparent && !colorScheme.TabBackground.IsEmpty)
            {
                if (colorScheme.TabBackground2.IsEmpty)
                {
                    if (!colorScheme.TabBackground.IsEmpty)
                    {
                        using (SolidBrush brush = new SolidBrush(colorScheme.TabBackground))
                            g.FillRectangle(brush, clientRect);
                    }
                }
                else
                {
                    using (SolidBrush brush = new SolidBrush(Color.White))
                        g.FillRectangle(brush, clientRect);
                    using (LinearGradientBrush brush = CreateTabGradientBrush(clientRect, colorScheme.TabBackground, colorScheme.TabBackground2, colorScheme.TabBackgroundGradientAngle))
                        g.FillRectangle(brush, clientRect);
                }
            }

            Rectangle selectedRect = Rectangle.Empty;
            if (tabStrip.SelectedTab != null)
                selectedRect = tabStrip.SelectedTab.DisplayRectangle;

            using(Region tabRegion = new Region(tabStrip.DisplayRectangle))
                DrawBackground(tabStrip, clientRect, g, colorScheme, tabRegion, tabStrip.TabAlignment, selectedRect);

            Rectangle systemBoxRect = tabStrip.GetSystemBoxRectangle();
            systemBoxRect.Inflate(-2, -2);
            for (int i = tabStrip.Tabs.Count - 1; i >= 0; i--)
            {
                TabItem tab = tabStrip.Tabs[i];

                if (!tab.Visible || tab == tabStrip.SelectedTab)
                    continue;
                if(!tab.DisplayRectangle.IntersectsWith(systemBoxRect) && tab.DisplayRectangle.IntersectsWith(clientRect))
                    PaintTab(g, tab, false, false);
            }

            if (tabStrip.SelectedTab != null && tabStrip.Tabs.Contains(tabStrip.SelectedTab))
            {
                if (!GetAdjustedRect(tabStrip.SelectedTab).IntersectsWith(systemBoxRect))
                    PaintTab(g, tabStrip.SelectedTab, false, false);
            }

            g.ResetClip();
            tabStrip.PaintTabSystemBox(g);
        }
Exemple #2
0
		public override void Paint(Graphics g, TabStrip tabStrip)
		{
			base.Paint(g,tabStrip);

			TabColorScheme colorScheme=tabStrip.ColorScheme;
			Rectangle clientRect=tabStrip.DisplayRectangle;

            if (tabStrip.BackColor != Color.Transparent || colorScheme.TabBackground != Color.Transparent)
            {
                if (colorScheme.TabPanelBackground2.IsEmpty)
                {
                    if (!colorScheme.TabPanelBackground.IsEmpty)
                    {
                        using (SolidBrush brush = new SolidBrush(colorScheme.TabPanelBackground))
                            g.FillRectangle(brush, clientRect);
                    }
                }
                else
                {
                    using (SolidBrush brush = new SolidBrush(Color.White))
                        g.FillRectangle(brush, clientRect);
                    using (LinearGradientBrush brush = CreateTabGradientBrush(clientRect, colorScheme.TabPanelBackground, colorScheme.TabPanelBackground2, colorScheme.TabPanelBackgroundGradientAngle))
                        g.FillRectangle(brush, clientRect);
                }
            }

            Rectangle selectedRect = Rectangle.Empty;
            if (tabStrip.SelectedTab != null)
                selectedRect = tabStrip.SelectedTab.DisplayRectangle;
			DrawBackground(tabStrip, clientRect,g,colorScheme,new Region(tabStrip.DisplayRectangle),tabStrip.TabAlignment, selectedRect);

            tabStrip.ClipExcludeSystemBox(g);

			for(int i=tabStrip.Tabs.Count-1;i>=0;i--)
			{
				TabItem tab=tabStrip.Tabs[i];

				if(!tab.Visible || tab==tabStrip.SelectedTab || !tab.DisplayRectangle.IntersectsWith(clientRect))
					continue;
			
				PaintTab(g,tab,false,false);				
			}

			if(tabStrip.SelectedTab!=null && tabStrip.Tabs.Contains(tabStrip.SelectedTab))
			{
				PaintTab(g,tabStrip.SelectedTab,false,false);
			}

			g.ResetClip();
			tabStrip.PaintTabSystemBox(g);
		}