public void SetStyle(Style style) { _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style); this.BorderColor = _officeColorTable.TextBoxBorderColor; //_startPaint = true; this.Refresh(); }
/// <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); }
public TextBoxW() { // this.DoubleBuffered = true; _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style); this.BorderColor = _officeColorTable.TextBoxBorderColor; this.Refresh(); }
public void SetStyle(Style style) { _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style); this.BorderColor=_officeColorTable.TextBoxBorderColor; //_startPaint = true; this.Refresh(); }
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); }
/// <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); }
/// <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); }
public void SetStyle(Style style) { _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style); BaseColor = _officeColorTable.ComboBoxBaseColor; BorderColor = _officeColorTable.ComboBoxBorderColor; ArrowColor = _officeColorTable.ComboBoxArrowColor; this.Refresh(); }
protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; DrawTabStrip(g); OfficeColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(StyleManager.Style); BackColor = colorTable.MenuStripGradientBegin; }
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; }
public void SetStyle(Style style) { #region 加载窗体皮肤模板 OfficeColorTable officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style); this._backColor = officeColorTable.MenuStripGradientBegin; StyleManager.Style = style; #endregion }
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 }
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(); } }
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); }
public void SetStyle(Style style) { if (_useStyle) { _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style); this.ForeColor = _officeColorTable.LabelTextColor; } else { this.ForeColor = SystemColors.ControlText; } this.Refresh(); }
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(); }
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(); }
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(); }
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(); }
/// <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(); }
public TabControlW() : base() { SetStyles(); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.UserPaint, true); #region this.DrawMode = TabDrawMode.OwnerDrawFixed; this.Padding = new Point(CloseSize - 2, CloseSize - 5); this.MouseDown += OnMouseDown; #endregion //DefaultBaseColor = Color.FromArgb(175, 210, 255); _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style); this.BackColor = _officeColorTable.TabControlBackColor; this.BorderColor = _officeColorTable.TabControlBorderColor; this._pageForeColor = _officeColorTable.TabControlPageTextColor; this.DrawPageColor(); this.Refresh(); }
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(); } }
public void SetStyle(Style style) { _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style); BorderPen = new Pen(_officeColorTable.DateTimePickerBorder, 2); this.Refresh(); }
private void DrawPageColor() { if (_officeColorTable == null) { _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style); } for (int index = 0; index < base.TabCount; index++) { TabPage page = TabPages[index]; page.BackColor = _officeColorTable.TabControlPageBackColor; this.Refresh(); } }
private void DrawTabPages(Graphics g) { Rectangle tabRect; Point cusorPoint = PointToClient(MousePosition); bool hover; bool selected; bool hasSetClip = false; bool alignHorizontal = (Alignment == TabAlignment.Top || Alignment == TabAlignment.Bottom); LinearGradientMode mode = alignHorizontal ? LinearGradientMode.Vertical : LinearGradientMode.Horizontal; if (alignHorizontal) { IntPtr upDownButtonHandle = UpDownButtonHandle; bool hasUpDown = upDownButtonHandle != IntPtr.Zero; if (hasUpDown) { if (WinMethod.IsWindowVisible(upDownButtonHandle)) { RECT upDownButtonRect; WinMethod.GetWindowRect(upDownButtonHandle, out upDownButtonRect); Rectangle upDownRect = Rectangle.FromLTRB( upDownButtonRect.Left, upDownButtonRect.Top, upDownButtonRect.Right, upDownButtonRect.Bottom); upDownRect = RectangleToClient(upDownRect); switch (Alignment) { case TabAlignment.Top: upDownRect.Y = 0; break; case TabAlignment.Bottom: upDownRect.Y = ClientRectangle.Height - DisplayRectangle.Height; break; } upDownRect.Height = ClientRectangle.Height; g.SetClip(upDownRect, CombineMode.Exclude); hasSetClip = true; } } } for (int index = 0; index < base.TabCount; index++) { TabPage page = TabPages[index]; tabRect = GetTabRect(index); tabRect.X -= 2; tabRect.Y -= 2; hover = tabRect.Contains(cusorPoint); selected = SelectedIndex == index; Color baseColor = _baseColor; Color borderColor = _borderColor; if (_officeColorTable == null) { _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(_style); } //Color[] colors = new[] { Color.Black, Color.BlanchedAlmond, Color.Khaki, Color.Brown, Color.Brown }; Color[] colors = new[] { _officeColorTable.TabControlPageNormalBackColor1, _officeColorTable.TabControlPageNormalBackColor2, _officeColorTable.TabControlPageNormalBackColor3, _officeColorTable.TabControlPageNormalBackColor4, _officeColorTable.TabControlPageNormalBackColor5 }; if (selected) { colors = new[] { _officeColorTable.TabControlPageSelectColor1, _officeColorTable.TabControlPageSelectColor2, _officeColorTable.TabControlPageSelectColor3, _officeColorTable.TabControlPageSelectColor4, _officeColorTable.TabControlPageSelectColor5 }; } else if (hover) { colors = new[] { _officeColorTable.TabControlPageHoverColor1, _officeColorTable.TabControlPageHoverColor2, _officeColorTable.TabControlPageHoverColor3, _officeColorTable.TabControlPageHoverColor4, _officeColorTable.TabControlPageHoverColor5 }; } else//自定义 { colors = new[] { _officeColorTable.TabControlPageNormalBackColor1, _officeColorTable.TabControlPageNormalBackColor2, _officeColorTable.TabControlPageNormalBackColor3, _officeColorTable.TabControlPageNormalBackColor4, _officeColorTable.TabControlPageNormalBackColor5 }; } RenderTabBackgroundInternal( g, tabRect, baseColor, borderColor, .3F, mode, colors); bool hasImage = DrawTabImage(g, page, tabRect); DrawtabText(g, page, tabRect, hasImage); } if (hasSetClip) { g.ResetClip(); } }
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; }
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)); }
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); }
public void SetStyle(Style style) { _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style); this.BackColor = _officeColorTable.TabControlBackColor; this.BorderColor = _officeColorTable.TabControlBorderColor; this._pageForeColor = _officeColorTable.TabControlPageTextColor; _style = style; this.DrawPageColor(); this.Refresh(); }