Beispiel #1
0
        protected virtual void DrawBackground(TabStrip tabStrip, Rectangle tabStripRect, Graphics g, TabColorScheme colors, Region tabsRegion, eTabStripAlignment tabAlignment, Rectangle selectedTabRect)
		{
			if(colors.TabBackground2.IsEmpty)
			{
                if (!colors.TabBackground.IsEmpty)
                {
                    using (SolidBrush brush = new SolidBrush(colors.TabBackground))
                        g.FillRegion(brush, tabsRegion);
                }
			}
			else
			{
				using(LinearGradientBrush brush=BarFunctions.CreateLinearGradientBrush(tabsRegion.GetBounds(g),colors.TabBackground,colors.TabBackground2,colors.TabBackgroundGradientAngle))
					g.FillRegion(brush, tabsRegion);
			}

		}
Beispiel #2
0
        private GraphicsPath GetTabItemPath(Rectangle tabRect, eTabStripAlignment align, bool closePath)
        {
            GraphicsPath path = new GraphicsPath();
            switch (align)
            {
                case eTabStripAlignment.Top:
                    {
                        //tabRect.Width--;
                        if (closePath) tabRect.Height+=2;
                        path.AddLine(tabRect.X, tabRect.Bottom, tabRect.X, tabRect.Y + m_CornerSize);
                        path.AddLine(tabRect.X, tabRect.Y + m_CornerSize, tabRect.X+m_CornerSize, tabRect.Y);
                        path.AddLine(tabRect.X + m_CornerSize, tabRect.Y, tabRect.Right-m_CornerSize, tabRect.Y);
                        path.AddLine(tabRect.Right - m_CornerSize, tabRect.Y, tabRect.Right, tabRect.Y+m_CornerSize);
                        path.AddLine(tabRect.Right, tabRect.Y + m_CornerSize, tabRect.Right, tabRect.Bottom);
                        break;
                    }
                case eTabStripAlignment.Bottom:
                    {
                        //tabRect.Width--;
                        if (!closePath)
                            tabRect.Y++;
                        tabRect.Height--;
                        path.AddLine(tabRect.X, tabRect.Y, tabRect.X, tabRect.Bottom - m_CornerSize);
                        path.AddLine(tabRect.X, tabRect.Bottom - m_CornerSize, tabRect.X + m_CornerSize, tabRect.Bottom);
                        path.AddLine(tabRect.X + m_CornerSize, tabRect.Bottom, tabRect.Right - m_CornerSize, tabRect.Bottom);
                        path.AddLine(tabRect.Right - m_CornerSize, tabRect.Bottom, tabRect.Right, tabRect.Bottom - m_CornerSize);
                        path.AddLine(tabRect.Right, tabRect.Bottom - m_CornerSize, tabRect.Right, tabRect.Y);
                        break;
                    }
                case eTabStripAlignment.Left:
                    {
                        tabRect.X--;
                        tabRect.Height--;
                        if (closePath)
                            tabRect.Width++;
                        path.AddLine(tabRect.Right, tabRect.Y, tabRect.X + m_CornerSize, tabRect.Y);
                        path.AddLine(tabRect.X + m_CornerSize, tabRect.Y, tabRect.X, tabRect.Y+m_CornerSize);
                        path.AddLine(tabRect.X, tabRect.Y + m_CornerSize, tabRect.X, tabRect.Bottom - m_CornerSize);
                        path.AddLine(tabRect.X, tabRect.Bottom - m_CornerSize, tabRect.X+m_CornerSize, tabRect.Bottom);
                        path.AddLine(tabRect.X + m_CornerSize, tabRect.Bottom, tabRect.Right, tabRect.Bottom);

                        break;
                    }
                case eTabStripAlignment.Right:
                    {
                        if (!closePath)
                            tabRect.X++;
                        //if (closePath)
                        //    tabRect.Width--;
                        path.AddLine(tabRect.X, tabRect.Y, tabRect.Right - m_CornerSize, tabRect.Y);
                        path.AddLine(tabRect.Right - m_CornerSize, tabRect.Y, tabRect.Right, tabRect.Y + m_CornerSize);
                        path.AddLine(tabRect.Right, tabRect.Y + m_CornerSize, tabRect.Right, tabRect.Bottom - m_CornerSize);
                        path.AddLine(tabRect.Right, tabRect.Bottom - m_CornerSize, tabRect.Right - m_CornerSize, tabRect.Bottom);
                        path.AddLine(tabRect.Right - m_CornerSize, tabRect.Bottom, tabRect.X, tabRect.Bottom);

                        break;
                    }
            }

            if (closePath)
                path.CloseAllFigures();

            return path;
        }
Beispiel #3
0
 protected virtual void AdjustTextRectangle(ref Rectangle rText, eTabStripAlignment tabAlignment) {}
Beispiel #4
0
        private GraphicsPath GetTabPath(Rectangle tabDisplayRectangle, eTabStripAlignment align, bool closePath)
        {
            Rectangle r = tabDisplayRectangle;

            if (align == eTabStripAlignment.Right)
                r = new Rectangle(r.X, r.Y, r.Height, r.Width);
            else if (align == eTabStripAlignment.Left)
                r = new Rectangle(r.X, r.Y, r.Height, r.Width);

            if (align == eTabStripAlignment.Bottom || align == eTabStripAlignment.Top)
                r.Offset(0, 1);
            else
                r.Offset(1, 0);

            GraphicsPath path = new GraphicsPath();

            if (align == eTabStripAlignment.Bottom || align == eTabStripAlignment.Left)
            {
                path.AddLine(r.X, r.Y, r.X, r.Bottom - m_TopLeftCornerSize);
                path.AddLine(r.X, r.Bottom - m_TopLeftCornerSize, r.X+m_TopLeftCornerSize, r.Bottom);
                path.AddLine(r.X + m_TopLeftCornerSize, r.Bottom, r.Right - (r.Height/2), r.Bottom);

                Point[] p = new Point[4];
                p[0].X = r.Right - (r.Height / 2);
                p[0].Y = r.Bottom;
                p[1].X = p[0].X + 5;
                p[1].Y = p[0].Y - 3;
                p[2].X = p[1].X + r.Height / 2;
                p[2].Y = r.Y + 3;
                p[3].X = p[2].X + 4;
                p[3].Y = r.Y;
                path.AddCurve(p, 0, 3, .1f);

                if (closePath)
                    path.AddLine(r.Right, r.Y, r.X, r.Y);
            }
            else
            {
                path.AddLine(r.X, r.Bottom, r.X, r.Y + m_TopLeftCornerSize);
                path.AddLine(r.X, r.Y + m_TopLeftCornerSize, r.X + m_TopLeftCornerSize, r.Y);
                path.AddLine(r.X + m_TopLeftCornerSize, r.Y, r.Right - (r.Height / 2), r.Y);

                Point[] p = new Point[4];
                p[0].X = r.Right - (r.Height / 2);
                p[0].Y = r.Y;
                p[1].X = p[0].X + 5;
                p[1].Y = p[0].Y + 3;
                p[2].X = p[1].X + r.Height / 2;
                p[2].Y = r.Bottom - 3;
                p[3].X = p[2].X + 4;
                p[3].Y = r.Bottom;
                path.AddCurve(p, 0, 3, .1f);

                if (closePath)
                    path.AddLine(r.Right, r.Bottom, r.X, r.Bottom);
            }

            if (align == eTabStripAlignment.Left)
            {
                // Left
                Matrix m = new Matrix();
                m.RotateAt(90, new PointF(r.Right, r.Bottom));
                m.Translate(-r.Width-2, r.Width - (r.Height), MatrixOrder.Append);
                //m.RotateAt(-90, new PointF(r.X, r.Bottom));
                //m.Translate(r.Height, r.Width - r.Height, MatrixOrder.Append);
                path.Transform(m);
            }
            else if (align == eTabStripAlignment.Right)
            {
                // Right
                Matrix m = new Matrix();
                //RectangleF rf=path.GetBounds();
                m.RotateAt(90, new PointF(r.Right, r.Bottom));
                m.Translate(-r.Width, r.Width - (r.Height), MatrixOrder.Append);
                path.Transform(m);
            }

            if (closePath)
                path.CloseAllFigures();

            return path;
        }
Beispiel #5
0
        protected override void DrawBackground(TabStrip tabStrip, Rectangle tabStripRect, Graphics g, TabColorScheme colors, Region tabsRegion, eTabStripAlignment tabAlignment, Rectangle selectedTabRect)
        {
            base.DrawBackground(tabStrip, tabStripRect, g, colors, tabsRegion, tabAlignment, selectedTabRect);

            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;
            if (!colors.TabItemBorder.IsEmpty)
            {
                using (Pen pen = new Pen(colors.TabItemBorder, 1))
                {
                    if (tabAlignment == eTabStripAlignment.Top)
                    {
                        if (selectedTabRect.X > tabStripRect.Right)
                            selectedTabRect = Rectangle.Empty;
                        Rectangle r = new Rectangle(tabStripRect.X, tabStripRect.Bottom - 1, tabStripRect.Width, 2);
                        DisplayHelp.FillRectangle(g, r, colors.TabItemBackground, Color.Empty);
                        g.DrawLine(pen, r.X, r.Y, selectedTabRect.X - 1, r.Y);
                        g.DrawLine(pen, selectedTabRect.Right, r.Y, r.Right, r.Y);
                        g.DrawLine(pen, r.X, r.Y, r.X, r.Bottom);
                        g.DrawLine(pen, r.Right - 1, r.Y, r.Right - 1, r.Bottom);
                    }
                    else if (tabAlignment == eTabStripAlignment.Bottom)
                    {
                        if (selectedTabRect.X > tabStripRect.Right)
                            selectedTabRect = Rectangle.Empty;
                        Rectangle r = new Rectangle(tabStripRect.X, tabStripRect.Y, tabStripRect.Width, 1);
                        DisplayHelp.FillRectangle(g, r, colors.TabItemBackground, Color.Empty);
                        g.DrawLine(pen, r.X, r.Bottom - 1, selectedTabRect.X - 1, r.Bottom - 1);
                        g.DrawLine(pen, selectedTabRect.Right, r.Bottom - 1, r.Right, r.Bottom - 1);
                        g.DrawLine(pen, r.X, r.Y, r.X, r.Bottom - 1);
                        g.DrawLine(pen, r.Right - 1, r.Y, r.Right - 1, r.Bottom - 1);
                    }
                    else if (tabAlignment == eTabStripAlignment.Left)
                    {
                        if (selectedTabRect.Y > tabStripRect.Bottom)
                            selectedTabRect = Rectangle.Empty;
                        Rectangle r = new Rectangle(tabStripRect.Right - 1, tabStripRect.Y, 1, tabStripRect.Height);
                        DisplayHelp.FillRectangle(g, r, colors.TabItemBackground, Color.Empty);
                        g.DrawLine(pen, r.X, r.Y, r.X, selectedTabRect.Y - 1);
                        g.DrawLine(pen, r.X, selectedTabRect.Bottom, r.X, r.Bottom);
                        g.DrawLine(pen, r.X, r.Y, r.Right, r.Y);
                        g.DrawLine(pen, r.X, r.Bottom - 1, r.Right, r.Bottom - 1);
                    }
                    else if (tabAlignment == eTabStripAlignment.Right)
                    {
                        if (selectedTabRect.Y > tabStripRect.Bottom)
                            selectedTabRect = Rectangle.Empty;
                        Rectangle r = new Rectangle(tabStripRect.X, tabStripRect.Y, 1, tabStripRect.Height);
                        DisplayHelp.FillRectangle(g, r, colors.TabItemBackground, Color.Empty);
                        g.DrawLine(pen, r.Right - 1, r.Y, r.Right - 1, selectedTabRect.Y - 1);
                        g.DrawLine(pen, r.Right - 1, selectedTabRect.Bottom, r.Right - 1, r.Bottom);
                        g.DrawLine(pen, r.X, r.Y, r.Right - 1, r.Y);
                        g.DrawLine(pen, r.X, r.Bottom - 1, r.Right - 1, r.Bottom - 1);
                    }
                }
            }
            g.SmoothingMode = sm;
        }
Beispiel #6
0
        protected override void DrawBackground(TabStrip tabStrip, Rectangle tabStripRect, Graphics g, TabColorScheme colors, Region tabsRegion, eTabStripAlignment tabAlignment, Rectangle selectedTabRect)
        {
            base.DrawBackground(tabStrip, tabStripRect, g, colors, tabsRegion, tabAlignment, selectedTabRect);

            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;
            using (Pen pen = new Pen(colors.TabItemBorder, 1))
            {
                int tabExtension = 9;
                if (selectedTabRect.IsEmpty)
                    tabExtension = 0;
                Color tabItemSelectedColor2 = colors.TabItemSelectedBackground2;
                if (tabStrip.SelectedTab != null)
                {
                    TabColors tc = tabStrip.GetTabColors(tabStrip.SelectedTab);
                    tabItemSelectedColor2 = tc.BackColor2;
                }
                if (tabAlignment == eTabStripAlignment.Top)
                {
                    if (selectedTabRect.X > tabStripRect.Right || selectedTabRect.Bottom < tabStripRect.Bottom - 4)
                    {
                        selectedTabRect = Rectangle.Empty;
                        tabExtension = 0;
                    }
                    Rectangle r = new Rectangle(tabStripRect.X, tabStripRect.Bottom - 1, tabStripRect.Width, 1);
                    DisplayHelp.FillRectangle(g, r, tabItemSelectedColor2, Color.Empty);
                    g.DrawLine(pen, r.X, r.Y, selectedTabRect.X, r.Y);
                    g.DrawLine(pen, selectedTabRect.Right + tabExtension, r.Y, r.Right, r.Y);
                    g.DrawLine(pen, r.X, r.Y, r.X, r.Bottom);
                    g.DrawLine(pen, r.Right - 1, r.Y, r.Right - 1, r.Bottom);
                }
                else if (tabAlignment == eTabStripAlignment.Bottom)
                {
                    if (selectedTabRect.X > tabStripRect.Right || selectedTabRect.Y>4)
                    {
                        selectedTabRect = Rectangle.Empty;
                        tabExtension = 0;
                    }
                    Rectangle r = new Rectangle(tabStripRect.X, tabStripRect.Y, tabStripRect.Width, 1);
                    DisplayHelp.FillRectangle(g, r, tabItemSelectedColor2, Color.Empty);
                    g.DrawLine(pen, r.X, r.Bottom -1, selectedTabRect.X, r.Bottom - 1);
                    g.DrawLine(pen, selectedTabRect.Right + tabExtension, r.Bottom - 1, r.Right, r.Bottom - 1);
                    g.DrawLine(pen, r.X, r.Y, r.X, r.Bottom -1);
                    g.DrawLine(pen, r.Right - 1, r.Y, r.Right - 1, r.Bottom - 1);
                }
                else if (tabAlignment == eTabStripAlignment.Left)
                {
                    if (selectedTabRect.Y > tabStripRect.Bottom || selectedTabRect.Right < tabStripRect.Right - 4)
                    {
                        selectedTabRect = Rectangle.Empty;
                        tabExtension = 0;
                    }
                    Rectangle r = new Rectangle(tabStripRect.Right -1, tabStripRect.Y, 1, tabStripRect.Height);
                    DisplayHelp.FillRectangle(g, r, tabItemSelectedColor2, Color.Empty);
                    g.DrawLine(pen, r.X, r.Y, r.X, selectedTabRect.Y);
                    g.DrawLine(pen, r.X, selectedTabRect.Bottom + tabExtension, r.X, r.Bottom);
                    g.DrawLine(pen, r.X, r.Y, r.Right, r.Y);
                    g.DrawLine(pen, r.X, r.Bottom - 1, r.Right, r.Bottom - 1);
                }
                else if (tabAlignment == eTabStripAlignment.Right)
                {
                    if (selectedTabRect.Y > tabStripRect.Bottom || selectedTabRect.X>4)
                    {
                        selectedTabRect = Rectangle.Empty;
                        tabExtension = 0;
                    }
                    Rectangle r = new Rectangle(tabStripRect.X, tabStripRect.Y, 1, tabStripRect.Height);
                    DisplayHelp.FillRectangle(g, r, tabItemSelectedColor2, Color.Empty);
                    g.DrawLine(pen, r.Right - 1, r.Y, r.Right - 1, selectedTabRect.Y);
                    g.DrawLine(pen, r.Right - 1, selectedTabRect.Bottom + tabExtension, r.Right - 1, r.Bottom);
                    g.DrawLine(pen, r.X, r.Y, r.Right, r.Y);
                    g.DrawLine(pen, r.X, r.Bottom - 1, r.Right, r.Bottom - 1);
                }
            }
            g.SmoothingMode = sm;
        }
Beispiel #7
0
 protected override void AdjustTextRectangle(ref Rectangle rText, eTabStripAlignment tabAlignment)
 {
     if (tabAlignment == eTabStripAlignment.Top || tabAlignment == eTabStripAlignment.Bottom)
         rText.Width -= 3;
     base.AdjustTextRectangle(ref rText, tabAlignment);
 }
Beispiel #8
0
        private void LoadCommonProperties(System.Xml.XmlElement xmlBar)
        {
            m_BarState = eBarState.Docked;
            this.Name = xmlBar.GetAttribute("name");
            if (xmlBar.HasAttribute("candockleft"))
                m_CanDockLeft = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candockleft"));
            if (xmlBar.HasAttribute("candockright"))
                m_CanDockRight = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candockright"));
            if (xmlBar.HasAttribute("candocktop"))
                m_CanDockTop = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candocktop"));
            if (xmlBar.HasAttribute("candockbottom"))
                m_CanDockBottom = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candockbottom"));
            if (xmlBar.HasAttribute("candockdoc"))
                m_CanDockDocument = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candockdoc"));
            if (xmlBar.HasAttribute("candocktab"))
                m_CanDockTab = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("candocktab"));
            if (xmlBar.HasAttribute("text"))
                this.Text = xmlBar.GetAttribute("text");
            if (xmlBar.HasAttribute("dockline"))
                m_DockLine = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dockline"));
            if (xmlBar.HasAttribute("dockoffset"))
                m_DockOffset = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dockoffset"));
            if (xmlBar.HasAttribute("grabhandle"))
                m_GrabHandleStyle = (eGrabHandleStyle)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("grabhandle"));
            if (xmlBar.HasAttribute("menubar"))
                m_MenuBar = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("menubar"));
            if (xmlBar.HasAttribute("stretch"))
                m_DockStretch = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("stretch"));
            if (xmlBar.HasAttribute("wrapdock"))
                m_WrapItemsDock = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("wrapdock"));
            if (xmlBar.HasAttribute("wrapfloat"))
                m_WrapItemsFloat = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("wrapfloat"));
            if (xmlBar.HasAttribute("custom"))
                m_CustomBar = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("custom"));
            if (xmlBar.HasAttribute("canhide"))
                m_CanHide = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("canhide"));
            if (xmlBar.HasAttribute("imagesize"))
                m_ImageSize = (eBarImageSize)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("imagesize"));

            if (xmlBar.HasAttribute("itemsp"))
                m_ItemContainer.ItemSpacing = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("itemsp"));
            //			else
            //				m_ItemContainer.ItemSpacing=0;

            if (xmlBar.HasAttribute("backcolor"))
                m_ItemContainer.BackColor = BarFunctions.ColorFromString(xmlBar.GetAttribute("backcolor"));

            if (xmlBar.HasAttribute("layout"))
                m_ItemContainer.LayoutType = (eLayoutType)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("layout"));

            if (xmlBar.HasAttribute("eqbutton"))
                m_ItemContainer.EqualButtonSize = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("eqbutton"));

            if (xmlBar.HasAttribute("dborder"))
                m_DockedBorder = (eBorderType)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dborder"));
            //else
            //    m_DockedBorder=eBorderType.None;

            if (xmlBar.HasAttribute("acceptdrop"))
                m_AcceptDropItems = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("acceptdrop"));

            if (xmlBar.HasAttribute("slcolor"))
                m_SingleLineColor = BarFunctions.ColorFromString(xmlBar.GetAttribute("slcolor"));

            if (xmlBar.HasAttribute("captionbc"))
                m_CaptionBackColor = BarFunctions.ColorFromString(xmlBar.GetAttribute("captionbc"));
            if (xmlBar.HasAttribute("captionfc"))
                m_CaptionForeColor = BarFunctions.ColorFromString(xmlBar.GetAttribute("captionfc"));

            if (xmlBar.HasAttribute("dockwidth"))
                m_ItemContainer.MinWidth = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dockwidth"));
            if (xmlBar.HasAttribute("dockheight"))
                m_ItemContainer.MinHeight = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("dockheight"));

            if (xmlBar.HasAttribute("splitwidthpercent"))
                m_SplitDockWidthPercent = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("splitwidthpercent"));
            else
                m_SplitDockWidthPercent = 0;
            if (xmlBar.HasAttribute("splitheightpercent"))
                m_SplitDockHeightPercent = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("splitheightpercent"));
            //			else
            //				m_SplitDockHeightPercent=0;

            if (xmlBar.HasAttribute("padbottom"))
                m_ItemContainer.PaddingBottom = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("padbottom"));
            if (xmlBar.HasAttribute("padleft"))
                m_ItemContainer.PaddingLeft = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("padleft"));
            if (xmlBar.HasAttribute("padright"))
                m_ItemContainer.PaddingRight = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("padright"));
            if (xmlBar.HasAttribute("padtop"))
                m_ItemContainer.PaddingTop = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("padtop"));

            if (xmlBar.HasAttribute("lockdockpos"))
                m_LockDockPosition = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("lockdockpos"));
            if (xmlBar.HasAttribute("canundock"))
                m_CanUndock = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("canundock"));
            if (xmlBar.HasAttribute("canreordertabs"))
                m_CanReorderTabs = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("canreordertabs"));
            if (xmlBar.HasAttribute("cantearoff"))
                m_CanTearOffTabs = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("cantearoff"));

            if (xmlBar.HasAttribute("canautohide"))
                m_CanAutoHide = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("canautohide"));

            if (xmlBar.HasAttribute("cancust"))
                m_ItemContainer.CanCustomize = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("cancust"));

            if (xmlBar.HasAttribute("tabalign"))
                m_DockTabAlignment = (eTabStripAlignment)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("tabalign"));

            if (xmlBar.HasAttribute("showtab"))
                m_AlwaysDisplayDockTab = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("showtab"));

            // TODO: Menu Merge Implementation
            //if(xmlBar.HasAttribute("merge"))
            //	m_MergeEnabled=System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("merge"));

            if (xmlBar.HasAttribute("hidein"))
                m_HideFloatingInactive = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("hidein"));

            if (xmlBar.HasAttribute("themes"))
            {
                m_ThemeAware = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("themes"));
                m_ItemContainer.ThemeAware = m_ThemeAware;
            }

            if (xmlBar.HasAttribute("tabnav"))
                m_TabNavigation = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("tabnav"));

            if (xmlBar.HasAttribute("tooltips"))
                m_ShowToolTips = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("tooltips"));
            //			else
            //				m_ShowToolTips=true;

            if (xmlBar.HasAttribute("overflowmenu"))
                m_ItemContainer.MoreItemsOnMenu = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("overflowmenu"));
            //			else
            //				m_ItemContainer.MoreItemsOnMenu=false;

            if (xmlBar.HasAttribute("autocaptionmenu"))
                m_AutoCreateCaptionMenu = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("autocaptionmenu"));
            //			else
            //				m_AutoCreateCaptionMenu=true;

            if (xmlBar.HasAttribute("autocaptionsync"))
                this.AutoSyncBarCaption = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("autocaptionsync"));
            //			else
            //				this.AutoSyncBarCaption=false;

            if (xmlBar.HasAttribute("style"))
            {
                string sty = xmlBar.GetAttribute("style");
                //if (sty == "5")
                //    this.Style = eDotNetBarStyle.Office2007;
                //else
                this.Style = (eDotNetBarStyle)System.Xml.XmlConvert.ToInt32(sty);
            }

            // Load font information if it exists
            if (xmlBar.HasAttribute("fontname"))
            {
                string FontName = xmlBar.GetAttribute("fontname");
                float FontSize = System.Xml.XmlConvert.ToSingle(xmlBar.GetAttribute("fontemsize"));
                System.Drawing.FontStyle FontStyle = (System.Drawing.FontStyle)System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("fontstyle"));
                try
                {
                    this.Font = new Font(FontName, FontSize, FontStyle);
                }
                catch (Exception)
                {
                    this.Font = SystemFonts.MenuFont; // System.Windows.Forms.SystemInformation.MenuFont.Clone() as Font;
                }
                m_CustomFont = true;
            }

            if (xmlBar.HasAttribute("ahanim"))
                m_AutoHideAnimationTime = System.Xml.XmlConvert.ToInt32(xmlBar.GetAttribute("ahanim"));
            //			else
            //				m_AutoHideAnimationTime=100;

            if (xmlBar.HasAttribute("savelayout"))
                m_SaveLayoutChanges = System.Xml.XmlConvert.ToBoolean(xmlBar.GetAttribute("savelayout"));
            //			else
            //				m_SaveLayoutChanges=true;
        }
Beispiel #9
0
        protected override void DrawBackground(TabStrip tabStrip, Rectangle tabStripRect, Graphics g, TabColorScheme colors, Region tabsRegion, eTabStripAlignment tabAlignment, Rectangle selectedTabRect)
		{
			base.DrawBackground(tabStrip, tabStripRect,g,colors,tabsRegion,tabAlignment, selectedTabRect);

			if(!colors.TabItemBorder.IsEmpty)
			{
				using(Pen pen=new Pen(colors.TabItemBorder,1))
				{
					if(tabAlignment==eTabStripAlignment.Bottom)
					{
						g.DrawLine(pen,tabStripRect.X,tabStripRect.Y+1,tabStripRect.Right,tabStripRect.Y+1);
					}
					else if(tabAlignment==eTabStripAlignment.Left)
					{
						g.DrawLine(pen,tabStripRect.Right-1,tabStripRect.Y,tabStripRect.Right-1,tabStripRect.Bottom);
					}
					else if(tabAlignment==eTabStripAlignment.Right)
					{
						g.DrawLine(pen,tabStripRect.X,tabStripRect.Y,tabStripRect.X,tabStripRect.Bottom);
					}
					else if(tabAlignment==eTabStripAlignment.Top)
					{
						g.DrawLine(pen,tabStripRect.X,tabStripRect.Bottom-1,tabStripRect.Right,tabStripRect.Bottom-1);
					}
				}
			}
		}
Beispiel #10
0
		protected virtual Line GetBottomLine(Rectangle r,eTabStripAlignment align)
		{
			if(align==eTabStripAlignment.Top)
				return new Line(r.X,r.Bottom,r.Right,r.Bottom);
			else if(align==eTabStripAlignment.Bottom)
				return new Line(r.Right-m_SideWidth,r.Bottom,r.X+m_SideWidth,r.Bottom);
			return null;
		}
Beispiel #11
0
		private void DrawBackgroundInternal(Rectangle tabStripRect, Graphics g, TabColorScheme colors, Region tabsRegion, eTabStripAlignment tabAlignment, Rectangle tabItemsBounds)
		{
			int cornerDiameter=3;
			Rectangle br;
			GraphicsPath path=new GraphicsPath();
			GraphicsPath backPath=null;

			if(!tabItemsBounds.IsEmpty)
			{
				if(tabAlignment==eTabStripAlignment.Top)
				{
					tabItemsBounds.Width+=3;
					br=new Rectangle(tabStripRect.X,tabItemsBounds.Y+1,(tabItemsBounds.Right>tabStripRect.Right?tabStripRect.Width:tabItemsBounds.Right),tabItemsBounds.Height-1);
					path.AddLine(br.X,br.Bottom,br.X,br.Top+cornerDiameter);
					ArcData ad=GetCornerArc(br,cornerDiameter,eCornerArc.TopLeft);
					path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
					path.AddLine(br.X+cornerDiameter,br.Y,br.Right-cornerDiameter,br.Y);
					ad=GetCornerArc(br,cornerDiameter,eCornerArc.TopRight);
					path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
					path.AddLine(br.Right,br.Y+cornerDiameter,br.Right,br.Bottom);
					
					backPath=path.Clone() as GraphicsPath;
					backPath.CloseAllFigures();

					if(tabItemsBounds.Right<tabStripRect.Right)
						path.AddLine(br.Right,br.Bottom,tabStripRect.Right,br.Bottom);
				}
				else if(tabAlignment==eTabStripAlignment.Bottom)
				{
					tabItemsBounds.Width+=3;
					br=new Rectangle(tabStripRect.X,tabStripRect.Y,(tabItemsBounds.Right>tabStripRect.Right?tabStripRect.Width:tabItemsBounds.Right),tabItemsBounds.Height-1);
					path.AddLine(br.Right,br.Y,br.Right,br.Bottom-cornerDiameter);
					ArcData ad=GetCornerArc(br,cornerDiameter,eCornerArc.BottomRight);
					path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
					path.AddLine(br.Right-cornerDiameter,br.Bottom,br.X+cornerDiameter,br.Bottom);
					ad=GetCornerArc(br,cornerDiameter,eCornerArc.BottomLeft);
					path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
					path.AddLine(br.X,br.Bottom-cornerDiameter,br.X,br.Y);

					backPath=path.Clone() as GraphicsPath;
					backPath.CloseAllFigures();

					if(tabItemsBounds.Right<tabStripRect.Right)
						path.AddLine(br.Right,br.Y,tabStripRect.Right,br.Y);
				}
				else if(tabAlignment==eTabStripAlignment.Left)
				{
					tabItemsBounds.Height+=3;
					br=new Rectangle(tabItemsBounds.X+1,tabStripRect.Y,tabItemsBounds.Width-1,(tabItemsBounds.Bottom>tabStripRect.Bottom?tabStripRect.Height:tabItemsBounds.Bottom));
                    
                    path.AddLine(br.Right-1,br.Bottom,br.X+cornerDiameter,br.Bottom);
                    ArcData ad=GetCornerArc(br,cornerDiameter,eCornerArc.BottomLeft);
					path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
					path.AddLine(br.X,br.Bottom-cornerDiameter,br.X,br.Y+cornerDiameter);
					ad=GetCornerArc(br,cornerDiameter,eCornerArc.TopLeft);
					path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
                    path.AddLine(br.X+cornerDiameter,br.Y,br.Right-1,br.Y);

					backPath=path.Clone() as GraphicsPath;
					backPath.CloseAllFigures();

					if(tabItemsBounds.Bottom<tabStripRect.Bottom)
						path.AddLine(br.Right-1,br.Bottom,br.Right-1,tabStripRect.Bottom);
				}
				else if(tabAlignment==eTabStripAlignment.Right)
				{
					tabItemsBounds.Height+=3;
					br=new Rectangle(tabStripRect.X,tabStripRect.Y,tabItemsBounds.Width-1,(tabItemsBounds.Bottom>tabStripRect.Bottom?tabStripRect.Height:tabItemsBounds.Bottom));
					path.AddLine(br.X,br.Y,br.Right-cornerDiameter,br.Y);
					ArcData ad=GetCornerArc(br,cornerDiameter,eCornerArc.TopRight);
					path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
					path.AddLine(br.Right,br.Y+cornerDiameter,br.Right,br.Bottom-cornerDiameter);
					ad=GetCornerArc(br,cornerDiameter,eCornerArc.BottomRight);
					path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
					path.AddLine(br.Right-cornerDiameter,br.Bottom,br.X,br.Bottom);

					backPath=path.Clone() as GraphicsPath;
					backPath.CloseAllFigures();

					if(tabItemsBounds.Bottom<tabStripRect.Bottom)
						path.AddLine(br.X,br.Bottom,br.X,tabStripRect.Bottom);
				}
			}
			else
			{
				path.AddRectangle(tabStripRect);
			}

			// Paint background of the tab control
			//g.SetClip(backPath,CombineMode.Replace);
			//g.SetClip(tabsRegion,CombineMode.Exclude);
			
			if(colors.TabPanelBackground2.IsEmpty)
			{
				if(!colors.TabPanelBackground.IsEmpty)
				{
					using(SolidBrush brush=new SolidBrush(colors.TabPanelBackground))
						g.FillPath(brush,path);
				}
			}
			else
			{
				using(SolidBrush brush=new SolidBrush(Color.White))
					g.FillPath(brush,path);
				using(LinearGradientBrush brush=CreateTabGradientBrush(tabStripRect,colors.TabPanelBackground,colors.TabPanelBackground2,colors.TabPanelBackgroundGradientAngle))
					g.FillPath(brush,path);
			}

			if(!colors.TabBorder.IsEmpty)
			{
				path.CloseAllFigures();
				using(Pen pen=new Pen(colors.TabBorder,1))
					g.DrawPath(pen,path);
			}

            if (backPath != null)
                backPath.Dispose();
            if (path != null)
                path.Dispose();
		}
Beispiel #12
0
		protected virtual GraphicsPath GetTabPath(Rectangle r,eTabStripAlignment align)
		{
			GraphicsPath path=new GraphicsPath();
			Line l=GetLeftLine(r,align);
			path.AddLine(l.X1,l.Y1,l.X2,l.Y2);
			l=GetTopLine(r,align);
			path.AddLine(l.X1,l.Y1,l.X2,l.Y2);
			l=GetRightLine(r,align);
			path.AddLine(l.X1,l.Y1,l.X2,l.Y2);
			l=GetBottomLine(r,align);
			path.AddLine(l.X1,l.Y1,l.X2,l.Y2);
			path.CloseAllFigures();
			return path;
		}
Beispiel #13
0
        /// <summary>
        /// Sets the tab docking based upon the given alignment
        /// </summary>
        /// <param name="value"></param>
        private void SetTabDocking(eTabStripAlignment value)
        {
            _TabStrip.SuspendLayout();

            try
            {
                switch (value)
                {
                    case eTabStripAlignment.Top:
                        _TabStrip.Dock = DockStyle.Top;
                        break;

                    case eTabStripAlignment.Bottom:
                        _TabStrip.Dock = DockStyle.Bottom;
                        break;

                    case eTabStripAlignment.Left:
                        _TabStrip.Dock = DockStyle.Left;
                        break;

                    case eTabStripAlignment.Right:
                        _TabStrip.Dock = DockStyle.Right;
                        break;
                }

                _TabStrip.SendToBack();
            }
            finally
            {
                _TabStrip.ResumeLayout(true);
            }

            RefreshPanelsStyle();

            RecalcLayout();
        }
Beispiel #14
0
        private GraphicsPath GetTabPath(Rectangle r, int rightCornerSize, eTabStripAlignment align, bool bCloseFigure)
		{
			Rectangle rbox=r;

			if(align==eTabStripAlignment.Left)
			{
				// Left
				rbox=new Rectangle(r.X,r.Y,r.Height,r.Width);
			}
			else if(align==eTabStripAlignment.Right)
			{
				// Right
				rbox=new Rectangle(r.Right-r.Height,r.Y,r.Height,r.Width);
			}

			GraphicsPath path=new GraphicsPath();
			Point[] p=new Point[4];
			p[0].X=rbox.X+2-(rbox.Height+1);
			p[0].Y=rbox.Bottom-1;
			p[1].X=p[0].X+3;
			p[1].Y=p[0].Y-2;
			p[2].X=p[1].X+rbox.Height-6;
			p[2].Y=rbox.Y+3;
			p[3].X=p[2].X+4;
			p[3].Y=rbox.Y+1;
			path.AddCurve(p,0,3,.5f);
			path.AddLine(p[3].X+1,rbox.Y,rbox.Right-rightCornerSize,rbox.Y);
			path.AddLine(rbox.Right-rightCornerSize,rbox.Y,rbox.Right,rbox.Y+rightCornerSize);
			path.AddLine(rbox.Right,rbox.Y+rightCornerSize,rbox.Right,rbox.Bottom-1);
			if(bCloseFigure)
			{
				path.AddLine(p[0].X,rbox.Bottom,rbox.Right,rbox.Bottom);
				path.CloseAllFigures();
			}
			
			if(align==eTabStripAlignment.Bottom)
			{
                path.Dispose();
                path = new GraphicsPath();
                p = new Point[4];
                p[0].X = rbox.X + 2 - (rbox.Height + 1);
                p[0].Y = rbox.Top+1;
                p[1].X = p[0].X + 3;
                p[1].Y = p[0].Y + 2;
                p[2].X = p[1].X + rbox.Height - 6;
                p[2].Y = rbox.Bottom - 3;
                p[3].X = p[2].X + 4;
                p[3].Y = rbox.Bottom - 1;
                path.AddCurve(p, 0, 3, .5f);
                path.AddLine(p[3].X + 1, rbox.Bottom, rbox.Right - rightCornerSize, rbox.Bottom);
                path.AddLine(rbox.Right - rightCornerSize, rbox.Bottom, rbox.Right, rbox.Bottom - rightCornerSize);
                path.AddLine(rbox.Right, rbox.Bottom - rightCornerSize, rbox.Right, rbox.Y + 1);
                if (bCloseFigure)
                {
                    path.AddLine(p[0].X, rbox.Y, rbox.Right, rbox.Y);
                    path.CloseAllFigures();
                }
				// Bottom
                //Matrix m=new Matrix();
                ////RectangleF rf=path.GetBounds();
                //m.RotateAt(180,new PointF(rbox.X+rbox.Width/2,rbox.Y+rbox.Height/2));
                //path.Transform(m);
			}
			else if(align==eTabStripAlignment.Left)
			{
				// Left
				Matrix m=new Matrix();
				//RectangleF rf=path.GetBounds();
				m.RotateAt(-90,new PointF(rbox.X,rbox.Bottom));
				m.Translate(rbox.Height,rbox.Width-rbox.Height,MatrixOrder.Append);
				path.Transform(m);
			}
			else if(align==eTabStripAlignment.Right)
			{
				// Right
				Matrix m=new Matrix();
				//RectangleF rf=path.GetBounds();
				m.RotateAt(90,new PointF(rbox.Right,rbox.Bottom));
				m.Translate(-rbox.Height,rbox.Width-(rbox.Height-1),MatrixOrder.Append);
				path.Transform(m);
			}

			return path;
		}
Beispiel #15
0
        protected override void DrawBackground(TabStrip tabStrip, Rectangle tabStripRect, Graphics g, TabColorScheme colors, Region tabsRegion, eTabStripAlignment tabAlignment, Rectangle selectedTabRect)
		{
			int cornerDiameter=5;
			Rectangle br;
			GraphicsPath path=new GraphicsPath();
			if(tabAlignment==eTabStripAlignment.Top)
			{
				br=new Rectangle(tabStripRect.X,tabStripRect.Y+tabStripRect.Height/2,tabStripRect.Width-1,tabStripRect.Height-tabStripRect.Height/2);
				path.AddLine(br.X,br.Bottom,br.X,br.Top+cornerDiameter);
				ArcData ad=GetCornerArc(br,cornerDiameter,eCornerArc.TopLeft);
				path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
				path.AddLine(br.X+cornerDiameter,br.Y,br.Right-cornerDiameter,br.Y);
				ad=GetCornerArc(br,cornerDiameter,eCornerArc.TopRight);
				path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
				path.AddLine(br.Right,br.Y+cornerDiameter,br.Right,br.Bottom);
			}
			else if(tabAlignment==eTabStripAlignment.Bottom)
			{
				br=new Rectangle(tabStripRect.X,tabStripRect.Y,tabStripRect.Width-1,tabStripRect.Height/2);
				path.AddLine(br.Right,br.Y,br.Right,br.Bottom-cornerDiameter);
				ArcData ad=GetCornerArc(br,cornerDiameter,eCornerArc.BottomRight);
				path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
				path.AddLine(br.Right-cornerDiameter,br.Bottom,br.X+cornerDiameter,br.Bottom);
				ad=GetCornerArc(br,cornerDiameter,eCornerArc.BottomLeft);
				path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
				path.AddLine(br.X,br.Bottom-cornerDiameter,br.X,br.Y);
			}
			else if(tabAlignment==eTabStripAlignment.Left)
			{
				br=new Rectangle(tabStripRect.X+tabStripRect.Width/2,tabStripRect.Y,tabStripRect.Width/2+1,tabStripRect.Height-1);
				path.AddLine(br.Right,br.Bottom,br.X+cornerDiameter,br.Bottom);
				ArcData ad=GetCornerArc(br,cornerDiameter,eCornerArc.BottomLeft);
				path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
				path.AddLine(br.X,br.Bottom-cornerDiameter,br.X,br.Y+cornerDiameter);
				ad=GetCornerArc(br,cornerDiameter,eCornerArc.TopLeft);
				path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
				path.AddLine(br.X+cornerDiameter,br.Y,br.Right,br.Y);
			}
			else if(tabAlignment==eTabStripAlignment.Right)
			{
				br=new Rectangle(tabStripRect.X,tabStripRect.Y,tabStripRect.Width/2,tabStripRect.Height-1);
				path.AddLine(br.X,br.Y,br.Right-cornerDiameter,br.Y);
				ArcData ad=GetCornerArc(br,cornerDiameter,eCornerArc.TopRight);
				path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
				path.AddLine(br.Right,br.Y+cornerDiameter,br.Right,br.Bottom-cornerDiameter);
				ad=GetCornerArc(br,cornerDiameter,eCornerArc.BottomRight);
				path.AddArc(ad.X,ad.Y,ad.Width,ad.Height,ad.StartAngle,ad.SweepAngle);
				path.AddLine(br.Right-cornerDiameter,br.Bottom,br.X,br.Bottom);
			}

			// Paint background of the tab control
			GraphicsPath backPath=path.Clone() as GraphicsPath;
			backPath.CloseAllFigures();
			g.SetClip(backPath,CombineMode.Replace);
			g.SetClip(tabsRegion,CombineMode.Exclude);
			g.Clear(colors.TabPanelBackground);
			g.ResetClip();
			backPath.Dispose();

			g.SetClip(tabsRegion,CombineMode.Exclude);
			
			using(Pen pen=new Pen(colors.TabBorder,1))
				g.DrawPath(pen,path);
			path.Dispose();
			g.ResetClip();
		}
 void SetTabPosition(eTabStripAlignment alignment)
 {
     st.TabAlignment = alignment;
     st.FixedTabSize = alignment == eTabStripAlignment.Top || alignment == eTabStripAlignment.Bottom ? Size.Empty : new Size(180, 0);
 }