Beispiel #1
0
        public void SetStyle(Style style)
        {
            ToolStripProfessionalRenderer toolStripRenderer = new Office2007Renderer();

            Panels.ProfessionalColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);

            PanelColors panelColorTable = colorTable.PanelColorTable;

            if (panelColorTable != null)
            {
                ControlCollection controls = new ControlCollection(this);
                PanelSettingsManager.SetPanelProperties(
                    //this.Controls,
                    controls,
                    panelColorTable);
            }
            this.m_currentToolStripRenderer = toolStripRenderer;
            if (colorTable.Equals(this.m_currentProfessionalColorTable) == false)
            {
                this.m_currentProfessionalColorTable = colorTable;
                object renderer = Activator.CreateInstance(this.m_currentToolStripRenderer.GetType(), new object[] { colorTable });
                this.m_currentToolStripRenderer = renderer as ToolStripProfessionalRenderer;
                ToolStripManager.Renderer       = this.m_currentToolStripRenderer;
            }
            this.Refresh();
        }
Beispiel #2
0
 /// <summary>
 /// 设置控件样式
 /// </summary>
 /// <param name="style"></param>
 public void SetStyle(Style style)
 {
     _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
     this.LineColor    = _officeColorTable.TabControlBorderColor;
     this.BackColor    = _officeColorTable.TreeViewBackColor;
     base.Invalidate(false);
 }
            protected override void OnPaint(PaintEventArgs e)
            {
                // Draw the border
                Graphics         g          = e.Graphics;
                OfficeColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style);

                if (DockState == DockState.DockBottomAutoHide)
                {
                    //g.DrawLine(SystemPens.ControlLightLight, 0, 1, ClientRectangle.Right, 1);
                    g.DrawLine(new Pen(colorTable.TabControlBorderColor), 0, 1, ClientRectangle.Right, 1);
                }
                else if (DockState == DockState.DockRightAutoHide)
                {
                    //g.DrawLine(SystemPens.ControlLightLight, 1, 0, 1, ClientRectangle.Bottom);
                    g.DrawLine(new Pen(colorTable.TabControlBorderColor), 1, 0, 1, ClientRectangle.Bottom);
                }
                else if (DockState == DockState.DockTopAutoHide)
                {
                    //g.DrawLine(SystemPens.ControlDark, 0, ClientRectangle.Height - 2, ClientRectangle.Right, ClientRectangle.Height - 2);
                    //g.DrawLine(SystemPens.ControlDarkDark, 0, ClientRectangle.Height - 1, ClientRectangle.Right, ClientRectangle.Height - 1);
                    g.DrawLine(new Pen(colorTable.TabControlBorderColor), 0, ClientRectangle.Height - 2, ClientRectangle.Right, ClientRectangle.Height - 2);
                    g.DrawLine(new Pen(colorTable.TabControlBorderColor), 0, ClientRectangle.Height - 1, ClientRectangle.Right, ClientRectangle.Height - 1);
                }
                else if (DockState == DockState.DockLeftAutoHide)
                {
                    //g.DrawLine(SystemPens.ControlDark, ClientRectangle.Width - 2, 0, ClientRectangle.Width - 2, ClientRectangle.Bottom);
                    //g.DrawLine(SystemPens.ControlDarkDark, ClientRectangle.Width - 1, 0, ClientRectangle.Width - 1, ClientRectangle.Bottom);

                    g.DrawLine(new Pen(colorTable.TabControlBorderColor), ClientRectangle.Width - 2, 0, ClientRectangle.Width - 2, ClientRectangle.Bottom);
                    g.DrawLine(new Pen(colorTable.TabControlBorderColor), ClientRectangle.Width - 1, 0, ClientRectangle.Width - 1, ClientRectangle.Bottom);
                }

                base.OnPaint(e);
            }
Beispiel #4
0
 /// <summary>
 /// 设置控件样式
 /// </summary>
 /// <param name="style"></param>
 public void SetStyle(Style style)
 {
     _officeColorTable  = StyleBuilderFactory.GetOffice2007ColorTable(style);
     this.BorderColor   = _officeColorTable.ListBoxBorderColor;
     this.SelectedColor = _officeColorTable.ListBoxSelectedColor;
     this.Refresh();
     base.Invalidate(false);
 }
 /// <summary>
 /// 设置控件样式
 /// </summary>
 /// <param name="style"></param>
 public void SetStyle(Style style)
 {
     _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
     this.BaseColor    = _officeColorTable.RadioButtonBaseColor;
     this.ForeColor    = _officeColorTable.RadioButtonTextColor;
     //this.Refresh();
     base.Invalidate(false);
 }
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            DrawTabStrip(g);
            OfficeColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style);

            BackColor = colorTable.MenuStripGradientBegin;
        }
Beispiel #7
0
        public void SetStyle(Style style)
        {
            #region 加载窗体皮肤模板

            OfficeColorTable officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
            this._backColor    = officeColorTable.MenuStripGradientBegin;
            StyleManager.Style = style;

            #endregion
        }
Beispiel #8
0
        private void DrawCaption(Graphics g)
        {
            OfficeColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style);

            if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0)
            {
                return;
            }

            if (DockPane.IsActivated)
            {
                //using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, ActiveBackColorGradientBegin, ActiveBackColorGradientEnd, LinearGradientMode.Vertical))
                //{
                //    brush.Blend = ActiveBackColorGradientBlend;
                //    g.FillRectangle(brush, ClientRectangle);
                //}

                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, colorTable.TabControlPageBackColor, colorTable.TabControlBorderColor, LinearGradientMode.Vertical))
                {
                    brush.Blend = ActiveBackColorGradientBlend;
                    g.FillRectangle(brush, ClientRectangle);
                }
            }
            else
            {
                //using (SolidBrush brush = new SolidBrush(InactiveBackColor))
                //{
                //    g.FillRectangle(brush, ClientRectangle);
                //}
                using (SolidBrush brush = new SolidBrush(colorTable.TabControlBorderColor))
                {
                    g.FillRectangle(brush, ClientRectangle);
                }
            }

            Rectangle rectCaption = ClientRectangle;

            Rectangle rectCaptionText = rectCaption;

            rectCaptionText.X     += TextGapLeft;
            rectCaptionText.Width -= TextGapLeft + TextGapRight;
            rectCaptionText.Width -= ButtonGapLeft + ButtonClose.Width + ButtonGapRight;
            if (ShouldShowAutoHideButton)
            {
                rectCaptionText.Width -= ButtonAutoHide.Width + ButtonGapBetween;
            }
            if (HasTabPageContextMenu)
            {
                rectCaptionText.Width -= ButtonOptions.Width + ButtonGapBetween;
            }
            rectCaptionText.Y      += TextGapTop;
            rectCaptionText.Height -= TextGapTop + TextGapBottom;
            TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), TextColor, TextFormat);//Modify by Agan 2013-06-09
            // TextRenderer.DrawText(g, DockPane.CaptionText, TextFont, DrawHelper.RtlTransform(this, rectCaptionText), Color.White, TextFormat);
        }
        public VS2005AutoHideStrip(DockPanel panel) : base(panel)
        {
            SetStyle(ControlStyles.ResizeRedraw |
                     ControlStyles.UserPaint |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.OptimizedDoubleBuffer, true);
            OfficeColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style);

            //BackColor = SystemColors.ControlLight;
            BackColor = colorTable.MenuStripGradientBegin;//Modify by Agan 2013-06-09
        }
Beispiel #10
0
 protected override void OnPaint(PaintEventArgs e)
 {
     // if DockWindow is document, draw the border
     if (DockState == DockState.Document)
     {
         OfficeColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style);
         e.Graphics.DrawRectangle(new Pen(colorTable.TabControlBorderColor), ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
     }
     //Modify by Agan 2013-06-09
     //e.Graphics.DrawRectangle(SystemPens.ControlDark, ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
     base.OnPaint(e);
 }
Beispiel #11
0
        public TreeViewW()
        {
            InitializeComponent();
            //this.SetStyle(ControlStyles.SupportsTransparentBackColor |
            //  ControlStyles.UserPaint |
            //  ControlStyles.ResizeRedraw |
            //  ControlStyles.DoubleBuffer, true);
            //this.SetStyle(ControlStyles.Opaque, false);

            _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style);
            this.LineColor    = _officeColorTable.TabControlBorderColor;
            this.BackColor    = _officeColorTable.TreeViewBackColor;
            base.Invalidate(false);
        }
        public RadioButtonW()
            : base()
        {
            SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.ResizeRedraw |
                ControlStyles.SupportsTransparentBackColor, true);

            _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style);
            this.BaseColor    = _officeColorTable.RadioButtonBaseColor;
            this.ForeColor    = _officeColorTable.RadioButtonTextColor;
            this.Refresh();
        }
Beispiel #13
0
        public void SetStyle(Style style)
        {
            _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
            if (_officeColorTable.GrouperBorderColor.IsEmpty)
            {
                this.BorderColor = Color.Silver;
            }
            else
            {
                this.BorderColor = _officeColorTable.GrouperBorderColor;
            }

            this.ForeColor = _officeColorTable.GrouperTextColor;
            this.BackColor = _officeColorTable.GrouperBackColor;
            _style         = style;
            this.Refresh();
        }
Beispiel #14
0
        /// <summary>This method will construct a new GroupBox control.</summary>
        public Grouper()
        {
            InitializeStyles();
            InitializeGroupBox();
            _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style);
            if (_officeColorTable.GrouperBorderColor.IsEmpty)
            {
                this.BorderColor = Color.Silver;
            }
            else
            {
                this.BorderColor = _officeColorTable.GrouperBorderColor;
            }

            this.ForeColor = _officeColorTable.GrouperTextColor;
            this.BackColor = _officeColorTable.GrouperBackColor;
            this.Refresh();
        }
        private void DrawTab(Graphics g, TabVS2005 tab)
        {
            OfficeColorTable colorTable    = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style);
            Rectangle        rectTabOrigin = GetTabRectangle(tab);

            if (rectTabOrigin.IsEmpty)
            {
                return;
            }

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

            GraphicsPath path = GetTabOutline(tab, false, true);

            //g.FillPath(BrushTabBackground, path);
            //g.FillPath(new SolidBrush(colorTable.TabControlPageBackColor), path);
            g.FillPath(new LinearGradientBrush(rectTabOrigin, colorTable.TabControlPageNormalBackColor1, colorTable.TabControlPageNormalBackColor4, 2), path);
            //g.DrawPath(PenTabBorder, path);//Modify by Agan 2013-06-09
            //g.DrawPath(new Pen(colorTable.TabControlBorderColor), path);
            g.DrawPath(new Pen(colorTable.TabControlBorderColor), path);
            // Set no rotate for drawing icon and text
            Matrix matrixRotate = g.Transform;

            g.Transform = MatrixIdentity;

            // Draw the icon
            Rectangle rectImage = rectTabOrigin;

            rectImage.X += ImageGapLeft;
            rectImage.Y += ImageGapTop;
            int imageHeight = rectTabOrigin.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, RtlTransform(rectImage, dockState));

            // Draw the text
            Rectangle rectText = rectTabOrigin;

            rectText.X     += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft;
            rectText        = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState);
            if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide)
            {
                g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabVertical);
            }
            //g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(colorTable.TabControlBorderColor), rectText, StringFormatTabVertical);
            else
            {
                g.DrawString(content.DockHandler.TabText, TextFont, BrushTabText, rectText, StringFormatTabHorizontal);
            }
            //g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(colorTable.TabControlBorderColor), rectText, StringFormatTabHorizontal);

            // Set rotate back
            g.Transform = matrixRotate;
        }