Esempio n. 1
0
 public void SetStyle(Style style)
 {
     _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
     this.BorderColor  = _officeColorTable.TextBoxBorderColor;
     //_startPaint = true;
     this.Refresh();
 }
Esempio n. 2
0
 public TextBoxW()
 {
     // this.DoubleBuffered = true;
     _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style);
     this.BorderColor  = _officeColorTable.TextBoxBorderColor;
     this.Refresh();
 }
Esempio n. 3
0
 public void SetStyle(Style style)
 {
     _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
     BaseColor         = _officeColorTable.ComboBoxBaseColor;
     BorderColor       = _officeColorTable.ComboBoxBorderColor;
     ArrowColor        = _officeColorTable.ComboBoxArrowColor;
     this.Refresh();
 }
Esempio n. 4
0
 public void SetStyle(Style style)
 {
     _officeColorTable      = StyleBuilderFactory.GetOffice2007ColorTable(style);
     _columnHeaderUpColor   = _officeColorTable.GridViewColumnHeaderUpColor;
     _columnHeaderDownColor = _officeColorTable.GridViewColumnHeaderDownColor;
     this.BackgroundColor   = _officeColorTable.GridViewBackColor;
     this.GridColor         = _officeColorTable.GridViewGridColor;
     _ForeColor             = _officeColorTable.GridViewTextColor;
 }
Esempio n. 5
0
        public void SetStyle(Style style)
        {
            if (_useStyle)
            {
                _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
                this.BaseColor    = _officeColorTable.CheckBoxBaseColor;
                this.BorderColor  = _officeColorTable.CheckBoxBorderColor;
                this.ForeColor    = _officeColorTable.CheckBoxTextColor;

                this.Refresh();
            }
        }
Esempio n. 6
0
 public void SetStyle(Style style)
 {
     if (_useStyle)
     {
         _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
         this.ForeColor    = _officeColorTable.LabelTextColor;
     }
     else
     {
         this.ForeColor = SystemColors.ControlText;
     }
     this.Refresh();
 }
Esempio n. 7
0
        public ComboBoxW()
        {
            DrawMode = DrawMode.OwnerDrawVariable;

            // If all of your boxes will be RightToLeft, uncomment
            // the following line to make RTL the default.
            //RightToLeft = RightToLeft.Yes;

            // Remove the Context Menu to disable pasting
            ContextMenu       = new ContextMenu();
            _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style);
            BaseColor         = _officeColorTable.ComboBoxBaseColor;
            BorderColor       = _officeColorTable.ComboBoxBorderColor;
            ArrowColor        = _officeColorTable.ComboBoxArrowColor;
            this.Refresh();
        }
Esempio n. 8
0
        public void SetStyle(Style style)
        {
            if (!this.Enabled)
            {
                _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(Style.Office2007Silver);
            }
            else
            {
                _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
            }

            this.BorderColor = _officeColorTable.ButtonBorderColor;
            this.ForeColor   = _officeColorTable.ButtonTextColor;
            this._style      = style;
            this.Refresh();
        }
Esempio n. 9
0
        private static void SetPanelsStyle(Control control, Style style)
        {
            ToolStripRenderer             m_currentToolStripRenderer;
            ToolStripProfessionalRenderer toolStripRenderer = new Office2007Renderer();

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

            PanelColors panelColorTable = colorTable.PanelColorTable;

            if (panelColorTable != null)
            {
                PanelSettingsManager.SetPanelProperties(
                    control.Controls,
                    panelColorTable);
            }
            m_currentToolStripRenderer = toolStripRenderer;
            object renderer = Activator.CreateInstance(m_currentToolStripRenderer.GetType(), new object[] { colorTable });

            m_currentToolStripRenderer = renderer as ToolStripProfessionalRenderer;
            ToolStripManager.Renderer  = m_currentToolStripRenderer;
        }
Esempio n. 10
0
        private void RenderConboBoxDropDownButton(
            Graphics g,
            Rectangle buttonRect,
            ControlState state)
        {
            Color baseColor   = Color.FromArgb(160, 250, 250, 250);
            Color backColor   = Color.FromArgb(160, 250, 250, 250);
            Color borderColor = base.Enabled ?
                                _borderColor : SystemColors.ControlDarkDark;
            Color arrowColor = base.Enabled ?
                               _arrowColor : SystemColors.ControlDarkDark;
            Rectangle rect = buttonRect;

            if (base.Enabled)
            {
                if (_officeColorTable == null)
                {
                    _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style);
                }

                switch (state)
                {
                case ControlState.Hover:
                    //baseColor = RenderHelper.GetColor(_baseColor, 0, -33, -22, -13);

                    baseColor   = _officeColorTable.ComboBoxHoverColor;
                    borderColor = _officeColorTable.ComboBoxBorderHoverColor;

                    break;

                case ControlState.Pressed:
                    baseColor   = _officeColorTable.ComboBoxPressColor;
                    borderColor = _officeColorTable.ComboBoxBorderPressColor;

                    break;

                default:
                    baseColor   = _officeColorTable.ComboBoxBaseColor;
                    borderColor = _officeColorTable.ComboBoxBorderColor;
                    break;
                }
            }
            else
            {
                baseColor = SystemColors.ControlDark;
            }

            rect.Inflate(-1, -1);

            RenderScrollBarArrowInternal(
                g,
                rect,
                baseColor,
                borderColor,
                backColor,
                arrowColor,
                RoundStyle.All,
                true,
                false,
                ArrowDirection.Down,
                LinearGradientMode.Vertical);
        }
Esempio n. 11
0
        public void FillGradients(Graphics gr)
        {
            int          origin = this.Height / 3;
            int          end    = this.Height;
            int          oe     = (end - origin) / 2;
            GraphicsPath pa;

            LinearGradientBrush lgbrush;
            Rectangle           rect;

            if (_showbase == e_showbase.Yes)
            {
                rect = new Rectangle(new Point(0, 0), new Size(this.Width - 1, this.Height - 1));
                pa   = new GraphicsPath();
                DrawArc(rect, pa);

                #region Main Gradient
                if (_officeColorTable == null)
                {
                    ////rendererColorTable = SkinBuilderFactory.GetRendererColorTable(_style);
                    //if (this.Enabled)
                    //{
                    _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style);
                    //}
                    //else
                    //{
                    //    _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(Style.Office2007Silver);
                    //}
                }
                ColorBlend mix = new ColorBlend();
                switch (_buttonMode)
                {
                case 0:
                    _colors = new[]
                    {
                        _officeColorTable.ButtonNormalGradientBegin,

                        _officeColorTable.ButtonNormalGradientEnd,
                        _officeColorTable.ButtonNormalGradientMiddle,
                        _officeColorTable.ButtonNormalGradientEnd,
                        _officeColorTable.ButtonNormalBorder
                    };

                    break;

                case 1:
                    _colors = new[]
                    {
                        _officeColorTable.ButtonSelectedGradientBegin,
                        _officeColorTable.ButtonSelectedGradientMiddle,
                        _officeColorTable.ButtonSelectedGradientEnd,
                        _officeColorTable.ButtonSelectedGradientEnd,
                        _officeColorTable.ButtonSelectedBorder
                    };
                    break;

                case 2:
                    _colors = new[]
                    {
                        _officeColorTable.ButtonPressedGradientBegin,
                        _officeColorTable.ButtonPressedGradientEnd,
                        _officeColorTable.ButtonPressedGradientMiddle,
                        _officeColorTable.ButtonPressedGradientEnd,
                        _officeColorTable.ButtonPressedGradientMiddle
                    };
                    break;
                }

                mix.Colors = new[] { _colors[0], _colors[1], _colors[2], _colors[3] };

                mix.Positions = new[] { 0.0F, 0.3F, 0.35F, 1.0F };

                lgbrush = new LinearGradientBrush(rect, Color.Transparent, Color.Transparent, LinearGradientMode.Vertical);
                lgbrush.InterpolationColors = mix;

                gr.FillPath(lgbrush, pa);

                #endregion

                #region Fill Band

                rect = new Rectangle(new Point(0, 0), new Size(this.Width, this.Height / 3));
                pa   = new GraphicsPath();
                int _rtemp = _radius;
                _radius = _rtemp - 1;
                DrawArc(rect, pa);

                if (_colors[0].A > 80)
                {
                    gr.FillPath(new SolidBrush(Color.FromArgb(60, 255, 255, 255)), pa);//wzw
                }
                _radius = _rtemp;

                #endregion

                #region SplitFill
                if (_splitbutton == e_splitbutton.Yes & mouse)
                {
                    FillSplit(gr);
                }


                #endregion

                #region SplitLine

                if (_splitbutton == e_splitbutton.Yes)
                {
                    if (_imagelocation == EImagelocation.Top)
                    {
                        switch (_buttonMode)
                        {
                        case 1:
                            gr.DrawLine(new Pen(_officeColorTable.ButtonSelectedBorder), new Point(1, this.Height - _splitdistance), new Point(this.Width - 1, this.Height - _splitdistance));
                            break;

                        case 2:
                            gr.DrawLine(new Pen(_officeColorTable.ButtonPressedBorder), new Point(1, this.Height - _splitdistance), new Point(this.Width - 1, this.Height - _splitdistance));
                            break;

                        default:
                            break;
                        }
                    }
                    else if (_imagelocation == EImagelocation.Left)
                    {
                        switch (_buttonMode)
                        {
                        case 1:
                            gr.DrawLine(new Pen(_officeColorTable.ButtonSelectedBorder), new Point(this.Width - _splitdistance, 0), new Point(this.Width - _splitdistance, this.Height));
                            break;

                        case 2:
                            gr.DrawLine(new Pen(_officeColorTable.ButtonPressedBorder), new Point(this.Width - _splitdistance, 0), new Point(this.Width - _splitdistance, this.Height));
                            break;

                        default:
                            break;
                        }
                    }
                }
                #endregion

                rect = new Rectangle(new Point(0, 0), new Size(this.Width - 1, this.Height - 1));
                pa   = new GraphicsPath();
                DrawArc(rect, pa);
                gr.DrawPath(new Pen(_colors[4], 0.9F), pa);

                pa.Dispose();
                lgbrush.Dispose();
            }
        }
Esempio n. 12
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            base.OnPaintBackground(e);

            Graphics  g = e.Graphics;
            Rectangle checkButtonRect;
            Rectangle textRect;

            CalculateRect(out checkButtonRect, out textRect);
            g.SmoothingMode = SmoothingMode.AntiAlias;

            Color backColor = ControlPaint.Light(_baseColor);
            Color borderColor;
            Color innerBorderColor;
            Color checkColor;
            bool  hover = false;

            if (Enabled)
            {
                if (_officeColorTable == null)
                {
                    _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style);
                }
                switch (ControlState)
                {
                case ControlState.Hover:
                    innerBorderColor = _officeColorTable.CheckBoxInnerBorderColor;
                    BorderColor      = _officeColorTable.CheckBoxBorderColor;
                    checkColor       = innerBorderColor;
                    hover            = true;
                    break;

                case ControlState.Pressed:
                    BorderColor      = _officeColorTable.CheckBoxBorderColor;
                    innerBorderColor = _officeColorTable.CheckBoxInnerBorderColor;
                    checkColor       = innerBorderColor;
                    break;

                default:
                    BorderColor      = _officeColorTable.CheckBoxBorderColor;
                    innerBorderColor = Color.Empty;
                    checkColor       = BorderColor;
                    break;
                }
            }
            else
            {
                borderColor      = SystemColors.ControlDark;
                innerBorderColor = SystemColors.ControlDark;
                checkColor       = SystemColors.ControlDark;
            }

            using (SolidBrush brush = new SolidBrush(Color.White))
            {
                g.FillRectangle(brush, checkButtonRect);
            }

            if (hover)
            {
                using (Pen pen = new Pen(innerBorderColor, 2F))
                {
                    g.DrawRectangle(pen, checkButtonRect);
                }
            }

            switch (CheckState)
            {
            case CheckState.Checked:
                DrawCheckedFlag(
                    g,
                    checkButtonRect,
                    //checkColor);//issue
                    this.BorderColor);
                break;

            case CheckState.Indeterminate:
                checkButtonRect.Inflate(-1, -1);
                using (GraphicsPath path = new GraphicsPath())
                {
                    path.AddEllipse(checkButtonRect);
                    using (PathGradientBrush brush = new PathGradientBrush(path))
                    {
                        brush.CenterColor    = checkColor;
                        brush.SurroundColors = new Color[] { Color.White };
                        Blend blend = new Blend();
                        blend.Positions = new float[] { 0f, 0.4f, 1f };
                        blend.Factors   = new float[] { 0f, 0.3f, 1f };
                        brush.Blend     = blend;
                        g.FillEllipse(brush, checkButtonRect);
                    }
                }
                checkButtonRect.Inflate(1, 1);

                break;
            }

            using (Pen pen = new Pen(BorderColor))
            {
                g.DrawRectangle(pen, checkButtonRect);
            }

            Color textColor = Enabled ? ForeColor : SystemColors.GrayText;

            TextRenderer.DrawText(
                g,
                Text,
                Font,
                textRect,
                textColor,
                GetTextFormatFlags(TextAlign, RightToLeft == RightToLeft.Yes));
        }
 public void SetStyle(Style style)
 {
     _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
     BorderPen         = new Pen(_officeColorTable.DateTimePickerBorder, 2);
     this.Refresh();
 }