예제 #1
0
		protected virtual CompositeImage GetTabImage(TabItem tab)
		{
			Image image=tab.GetImage();
			if(image!=null)
				return new CompositeImage(image,false);
			Icon icon=tab.Icon;
			if(icon!=null)
				return new CompositeImage(icon,false,tab.IconSize);

			return null;
		}
예제 #2
0
		private void DrawThemedTab(Graphics g, Rectangle tabRect, TabItem tab, eTextFormat strFormat, Rectangle rClip, bool drawBack, bool drawInner)
		{
			TabColors tabColor=this.GetTabColors(tab);
			ThemeTabStates tabState=ThemeTabStates.Normal;

			if(m_HotTab==tab)
				tabState=ThemeTabStates.Hot;
			else if(tab==m_SelectedTab)
				tabState=ThemeTabStates.Selected;

			if(drawBack)
			{
				if(tab==m_SelectedTab)
					m_ThemeTab.DrawBackground(g,ThemeTabParts.TabItem,tabState,new Rectangle(tabRect.X,tabRect.Y,tabRect.Width,tabRect.Height+1));
				else
					m_ThemeTab.DrawBackground(g,ThemeTabParts.TabItem,tabState,new Rectangle(tabRect.X,tabRect.Y,tabRect.Width,tabRect.Height+1));
			}

			tabRect.Offset(0,1);

			if(drawInner)
			{
                if (m_CloseButtonOnTabs && tab.CloseButtonVisible)
                {
                    Rectangle rc = PaintTabItemCloseButton(g, (m_Alignment == eTabStripAlignment.Left || m_Alignment == eTabStripAlignment.Right), tab.CloseButtonMouseOver, tab == m_HotTab || tab == this.SelectedTab, ref tabRect);
                    rc.Offset(tab.DisplayRectangle.Location);
                    tab.CloseButtonBounds = rc;
                }
                else
                    tab.CloseButtonBounds = Rectangle.Empty;

				Image tabImage=tab.GetImage();
				Icon icon=tab.Icon;
				if(tabImage!=null && tabImage.Width+4<=tabRect.Width || icon!=null && tab.IconSize.Width+4<=tabRect.Width)
				{
					if(icon!=null)
					{
						Rectangle rIcon=new Rectangle(tabRect.X+4,tabRect.Y+(tabRect.Height-tab.IconSize.Height)/2,tab.IconSize.Width,tab.IconSize.Height);
						if(rClip.Contains(rIcon))
							g.DrawIcon(icon,rIcon);
						tabRect.X+=(tab.IconSize.Width+2);
						tabRect.Width-=(tab.IconSize.Width+2);
					}
					else if(tabImage!=null)
					{
						g.DrawImage(tabImage,tabRect.X+4,tabRect.Y+(tabRect.Height-tabImage.Height)/2,tabImage.Width,tabImage.Height);
						tabRect.X+=(tabImage.Width+2);
						tabRect.Width-=(tabImage.Width+2);
					}
					tabRect.Inflate(0,-1);
					tabRect.Width-=4;
					tabRect.X+=3;
				}

				if(!m_DisplaySelectedTextOnly || tab==m_SelectedTab)
				{
					Font font=this.Font;
					if(tab==m_SelectedTab && m_SelectedTabFont!=null)
						font=m_SelectedTabFont;

					if(tabRect.Width>MIN_TEXT_WIDTH)
						TextDrawing.DrawString(g,tab.Text,font,tabColor.TextColor,tabRect,strFormat);
					if(m_ShowFocusRectangle && this.Focused && tab==m_SelectedTab)
						ControlPaint.DrawFocusRectangle(g,GetFocusRectangle(tabRect));
				}
			}
		}