private void SetLayout() { if (isMin6 && Application.RenderWithVisualStyles) { using (var g = CreateGraphics()) { // Back button var theme = new VisualStyleRenderer(VisualStyleElementEx.Navigation.BackButton.Normal); var bbSize = theme.GetPartSize(g, ThemeSizeType.Draw); // Title theme.SetParameters(VisualStyleElementEx.AeroWizard.TitleBar.Active); title.Font = theme.GetFont2(g); titleBar.Height = Math.Max(theme.GetMargins2(g, MarginProperty.ContentMargins).Top, bbSize.Height + 2); titleBar.ColumnStyles[0].Width = bbSize.Width + 4F; titleBar.ColumnStyles[1].Width = titleImageIcon != null ? titleImageList.ImageSize.Width + 4F : 0; backButton.Size = bbSize; // Header theme.SetParameters(VisualStyleElementEx.AeroWizard.HeaderArea.Normal); headerLabel.Font = theme.GetFont2(g); headerLabel.Margin = theme.GetMargins2(g, MarginProperty.ContentMargins); headerLabel.ForeColor = theme.GetColor(ColorProperty.TextColor); // Content theme.SetParameters(VisualStyleElementEx.AeroWizard.ContentArea.Normal); BackColor = theme.GetColor(ColorProperty.FillColor); contentArea.Font = theme.GetFont2(g); var cp = theme.GetMargins2(g, MarginProperty.ContentMargins); contentArea.ColumnStyles[0].Width = cp.Left; contentArea.RowStyles[1].Height = cp.Bottom; // Command theme.SetParameters(VisualStyleElementEx.AeroWizard.CommandArea.Normal); cp = theme.GetMargins2(g, MarginProperty.ContentMargins); commandArea.RowStyles[0].Height = cp.Top; commandArea.RowStyles[2].Height = cp.Bottom; commandArea.ColumnStyles[1].Width = contentArea.ColumnStyles[contentCol + 1].Width = cp.Right; commandAreaBorder.Height = 0; theme.SetParameters(VisualStyleElementEx.AeroWizard.Button.Normal); var btnHeight = theme.GetInteger(IntegerProperty.Height); commandAreaButtonFlowLayout.MinimumSize = new Size(0, btnHeight); var btnFont = theme.GetFont2(g); foreach (Control ctrl in commandAreaButtonFlowLayout.Controls) { ctrl.Font = btnFont; ctrl.Height = btnHeight; //ctrl.MaximumSize = new Size(0, btnHeight); } themePropsSet = true; } } else { commandAreaBorder.Height = 1; backButton.Size = new Size(GetUnthemedBackButtonImage().Width, GetUnthemedBackButtonImage().Height / 4); BackColor = UseAeroStyle ? SystemColors.Window : SystemColors.Control; } }
/// <include file='doc\CheckBoxRenderer.uex' path='docs/doc[@for="CheckBoxRenderer.DrawCheckBox3"]/*' /> /// <devdoc> /// <para> /// Renders a CheckBox control. /// </para> /// </devdoc> public static void DrawCheckBox(Graphics g, Point glyphLocation, Rectangle textBounds, string checkBoxText, Font font, TextFormatFlags flags, bool focused, CheckBoxState state) { Rectangle glyphBounds = new Rectangle(glyphLocation, GetGlyphSize(g, state)); Color textColor; if (RenderWithVisualStyles) { InitializeRenderer((int)state); visualStyleRenderer.DrawBackground(g, glyphBounds); textColor = visualStyleRenderer.GetColor(ColorProperty.TextColor); } else { if (IsMixed(state)) { ControlPaint.DrawMixedCheckBox(g, glyphBounds, ConvertToButtonState(state)); } else { ControlPaint.DrawCheckBox(g, glyphBounds, ConvertToButtonState(state)); } textColor = SystemColors.ControlText; } TextRenderer.DrawText(g, checkBoxText, font, textBounds, textColor, flags); if (focused) { ControlPaint.DrawFocusRectangle(g, textBounds); } }
internal static void DrawRadioButton(Graphics g, Point glyphLocation, Rectangle textBounds, string radioButtonText, Font font, TextFormatFlags flags, bool focused, RadioButtonState state, IntPtr hWnd) { Rectangle glyphBounds = new Rectangle(glyphLocation, GetGlyphSize(g, state, hWnd)); Color textColor; if (RenderWithVisualStyles) { InitializeRenderer((int)state); visualStyleRenderer.DrawBackground(g, glyphBounds); textColor = visualStyleRenderer.GetColor(ColorProperty.TextColor); } else { ControlPaint.DrawRadioButton(g, glyphBounds, ConvertToButtonState(state)); textColor = SystemColors.ControlText; } TextRenderer.DrawText(g, radioButtonText, font, textBounds, textColor, flags); if (focused) { ControlPaint.DrawFocusRectangle(g, textBounds); } }
/// <summary> /// Renders a Button control. /// </summary> public static void DrawButton(Graphics g, Rectangle bounds, string buttonText, Font font, TextFormatFlags flags, bool focused, PushButtonState state) { Rectangle contentBounds; Color textColor; if (RenderWithVisualStyles) { InitializeRenderer((int)state); visualStyleRenderer.DrawBackground(g, bounds); contentBounds = visualStyleRenderer.GetBackgroundContentRectangle(g, bounds); textColor = visualStyleRenderer.GetColor(ColorProperty.TextColor); } else { ControlPaint.DrawButton(g, bounds, ConvertToButtonState(state)); contentBounds = Rectangle.Inflate(bounds, -3, -3); textColor = SystemColors.ControlText; } TextRenderer.DrawText(g, buttonText, font, contentBounds, textColor, flags); if (focused) { ControlPaint.DrawFocusRectangle(g, contentBounds); } }
public ResponsiveLinkLabel() : base() { this.LinkVisited = false; this.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.AutoSize = true; this._properHand = LoadCursor(0, 32649); DataGridView d = new DataGridView(); Font f = d.DefaultCellStyle.Font; if (VisualStyleRenderer.IsSupported) { VisualStyles.ControlPanel.ControlPanelPart part = VisualStyles.ControlPanel.ControlPanelPart.TaskLink; VisualStyleRenderer renderer = VisualStyles.ControlPanel.GetRenderer(part, (int)VisualStyles.ControlPanel.TaskLinkState.Hot, true); using (Graphics g = Graphics.FromHwnd(IntPtr.Zero)) { this.Font = renderer.GetFont(g, FontProperty.GlyphFont); this.LinkColor = this.VisitedLinkColor = NormalColor = renderer.GetColor(ColorProperty.TextColor); renderer = VisualStyles.ControlPanel.GetRenderer(part, (int)VisualStyles.ControlPanel.TaskLinkState.Pressed); this.ActiveLinkColor = HoverColor = renderer.GetColor(ColorProperty.TextColor); renderer = VisualStyles.ControlPanel.GetRenderer(part, (int)VisualStyles.ControlPanel.TaskLinkState.Disabled); this.DisabledLinkColor = renderer.GetColor(ColorProperty.TextColor); } } }
private static void DrawBackground(Graphics g, Rectangle bounds, ComboBoxState state) { visualStyleRenderer.DrawBackground(g, bounds); if ((state != ComboBoxState.Disabled) && (visualStyleRenderer.GetColor(ColorProperty.FillColor) != SystemColors.Window)) { Rectangle backgroundContentRectangle = visualStyleRenderer.GetBackgroundContentRectangle(g, bounds); backgroundContentRectangle.Inflate(-2, -2); g.FillRectangle(SystemBrushes.Window, backgroundContentRectangle); } }
private static void DrawBackground(Graphics g, Rectangle bounds, TextBoxState state) { visualStyleRenderer.DrawBackground(g, bounds); if ((state != TextBoxState.Disabled) && (visualStyleRenderer.GetColor(ColorProperty.FillColor) != SystemColors.Window)) { Rectangle backgroundContentRectangle = visualStyleRenderer.GetBackgroundContentRectangle(g, bounds); using (SolidBrush brush = new SolidBrush(SystemColors.Window)) { g.FillRectangle(brush, backgroundContentRectangle); } } }
private static void DrawBackground(Graphics g, Rectangle bounds, TextBoxState state) { t_visualStyleRenderer.DrawBackground(g, bounds); if (state != TextBoxState.Disabled) { Color windowColor = t_visualStyleRenderer.GetColor(ColorProperty.FillColor); if (windowColor != SystemColors.Window) { Rectangle fillRect = t_visualStyleRenderer.GetBackgroundContentRectangle(g, bounds); g.FillRectangle(SystemBrushes.Window, fillRect); } } }
public static void DrawTabItem(Graphics g, Rectangle bounds, string tabItemText, Font font, TextFormatFlags flags, bool focused, TabItemState state) { InitializeRenderer(VisualStyleElement.Tab.TabItem.Normal, (int)state); visualStyleRenderer.DrawBackground(g, bounds); Rectangle rectangle = Rectangle.Inflate(bounds, -3, -3); Color foreColor = visualStyleRenderer.GetColor(ColorProperty.TextColor); TextRenderer.DrawText(g, tabItemText, font, rectangle, foreColor, flags); if (focused) { ControlPaint.DrawFocusRectangle(g, rectangle); } }
protected override void OnPaint(PaintEventArgs pe) { VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.TextBox.TextEdit.Normal); pe.Graphics.FillRectangle(new SolidBrush(renderer.GetColor(ColorProperty.FillColor)), this.ClientRectangle); if (_borderStyle == EditBorderStyle.Single) { Rectangle borderRect = this.ClientRectangle; borderRect.Width -= 1; borderRect.Height -= 1; pe.Graphics.DrawRectangle(new Pen(renderer.GetColor(ColorProperty.BorderColor)), borderRect); } base.OnPaint(pe); }
void _Initialize() { _WindowFrameColor = null; _InfoColor = null; _InfoTextColor = null; if (VisualStyleRenderer.IsSupported && VisualStyleRenderer.IsElementDefined(VisualStyleElement.ToolTip.Standard.Normal)) { try { var renderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.Standard.Normal); var canvasSize = new Size(7, 7); using (var bmp = new Bitmap(canvasSize.Width, canvasSize.Height)) { using (var graphics = Graphics.FromImage(bmp)) renderer.DrawBackground(graphics, new Rectangle(Point.Empty, canvasSize)); _InfoColor = bmp.GetPixel(canvasSize.Width / 2, canvasSize.Height / 2); _WindowFrameColor = bmp.GetPixel(0, canvasSize.Height / 2); } _InfoTextColor = renderer.GetColor(ColorProperty.TextColor); } catch (Exception e) { Debug.WriteLine(e.ToString()); } } }
/// <summary> /// <para> /// Renders a Tab item. /// </para> /// </summary> public static void DrawTabItem(Graphics g, Rectangle bounds, string tabItemText, Font font, TextFormatFlags flags, bool focused, TabItemState state) { InitializeRenderer(VisualStyleElement.Tab.TabItem.Normal, (int)state); visualStyleRenderer.DrawBackground(g, bounds); // GetBackgroundContentRectangle() returns same rectangle as bounds for this control! Rectangle contentBounds = Rectangle.Inflate(bounds, -3, -3); Color textColor = visualStyleRenderer.GetColor(ColorProperty.TextColor); TextRenderer.DrawText(g, tabItemText, font, contentBounds, textColor, flags); if (focused) { ControlPaint.DrawFocusRectangle(g, contentBounds); } }
Color GetItemTextColor(ToolStripItem item) { int partId = item.IsOnDropDown ? (int)MenuParts.PopupItem : (int)MenuParts.BarItem; renderer.SetParameters(MenuClass, partId, GetItemState(item)); return(renderer.GetColor(ColorProperty.TextColor)); }
/// <summary> /// Draws a single tab. /// </summary> /// <param name="g">A <see cref="T:System.Drawing.Graphics"/> object used to draw the tab control.</param> /// <param name="index">An index of the tab being drawn.</param> /// <param name="tabRect">A <see cref="T:System.Drawing.Rectangle"/> object specifying tab's bounds.</param> /// <param name="rend">A <see cref="T:System.Windows.Forms.VisualStyles.VisualStyleRenderer"/> object for rendering the tab.</param> private void DrawTabItem(Graphics g, int index, Rectangle tabRect, VisualStyleRenderer rend) { //if the scroller is visible and the tab is fully placed under it, we don't need to draw such tab if (fUpDown.X > 0 && tabRect.X >= fUpDown.X) { return; } bool tabSelected = rend.State == (int)TabItemState.Selected; // We will draw our tab on a bitmap and then transfer image to the control's graphic context. using (GDIMemoryContext memGDI = new GDIMemoryContext(g, tabRect.Width, tabRect.Height)) { Rectangle drawRect = new Rectangle(0, 0, tabRect.Width, tabRect.Height); rend.DrawBackground(memGDI.Graphics, drawRect); if (tabSelected && tabRect.X == 0) { int corrY = memGDI.Height - 1; memGDI.SetPixel(0, corrY, memGDI.GetPixel(0, corrY - 1)); } /* An important moment. If tabs alignment is bottom, we should flip the image to display the tab * correctly.*/ if (this.Alignment == TabAlignment.Bottom) { memGDI.FlipVertical(); } TabPage pg = this.TabPages[index];//tab page whose tab we're drawing //trying to get a tab image if any Image pagePict = this.GetImageByIndexOrKey(pg.ImageIndex, pg.ImageKey); if (pagePict != null) { //If tab image is present we should draw it. Point imgLoc = new Point(tabSelected ? 8 : 6, 2); int imgRight = imgLoc.X + pagePict.Width; if (this.Alignment == TabAlignment.Bottom) { imgLoc.Y = drawRect.Bottom - pagePict.Height - (tabSelected ? 4 : 2); } if (RightToLeftLayout) { imgLoc.X = drawRect.Right - imgRight; } memGDI.Graphics.DrawImageUnscaled(pagePict, imgLoc); //Correcting rectangle for drawing text. drawRect.X += imgRight; drawRect.Width -= imgRight; } //drawing tab text TextRenderer.DrawText(memGDI.Graphics, pg.Text, this.Font, drawRect, rend.GetColor(ColorProperty.TextColor), TextFormatFlags.SingleLine | TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter); //If the tab has part under scroller we shouldn't draw that part. if (fUpDown.X > 0 && fUpDown.X >= tabRect.X && fUpDown.X < tabRect.Right) { tabRect.Width -= tabRect.Right - fUpDown.X; } memGDI.DrawContextClipped(g, tabRect); } }
private static void DrawBackground(Graphics g, Rectangle bounds, TextBoxState state) { visualStyleRenderer.DrawBackground(g, bounds); if (state != TextBoxState.Disabled) { Color windowColor = visualStyleRenderer.GetColor(ColorProperty.FillColor); if (windowColor != SystemColors.Window) { Rectangle fillRect = visualStyleRenderer.GetBackgroundContentRectangle(g, bounds); //then we need to re-fill the background. using (SolidBrush brush = new SolidBrush(SystemColors.Window)) { g.FillRectangle(brush, fillRect); } } } }
private static void DrawBackground(Graphics g, Rectangle bounds, ComboBoxState state) { visualStyleRenderer.DrawBackground(g, bounds); //for disabled comboboxes, comctl does not use the window backcolor, so // we don't refill here in that case. if (state != ComboBoxState.Disabled) { Color windowColor = visualStyleRenderer.GetColor(ColorProperty.FillColor); if (windowColor != SystemColors.Window) { Rectangle fillRect = visualStyleRenderer.GetBackgroundContentRectangle(g, bounds); fillRect.Inflate(-2, -2); //then we need to re-fill the background. g.FillRectangle(SystemBrushes.Window, fillRect); } } }
private void InitFonts() { Colors = new ColorInfo(); if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer contentLink = VisualStyles.ControlPanel.GetRenderer(VisualStyles.ControlPanel.ControlPanelPart.ContentLink, (int)VisualStyles.ControlPanel.ContentLinkState.Normal, true); using (Graphics g = Graphics.FromHwnd(IntPtr.Zero)) { Colors.ContentLinkNormal = contentLink.GetColor(ColorProperty.TextColor); contentLink = VisualStyles.ControlPanel.GetRenderer(VisualStyles.ControlPanel.ControlPanelPart.ContentLink, (int)VisualStyles.ControlPanel.ContentLinkState.Hot, true); Colors.ContentLinkHot = contentLink.GetColor(ColorProperty.TextColor); } } }
private void OnDraw(object sender, DrawToolTipEventArgs e) { // Try to draw using the visual style renderer. if (VisualStyleRenderer.IsSupported && VisualStyleRenderer.IsElementDefined(VisualStyleElement.ToolTip.Standard.Normal)) { var bounds = e.Bounds; var renderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.Standard.Normal); renderer.DrawBackground(e.Graphics, bounds); var color = renderer.GetColor(ColorProperty.TextColor); var text = e.ToolTipText; using (var textBrush = new SolidBrush(renderer.GetColor(ColorProperty.TextColor))) using (var font = e.Font) { // Fix the positioning of the bounds for the text rectangle. var rendererBounds = new Rectangle(e.Bounds.X + 6, e.Bounds.Y + 2, e.Bounds.Width - 6 * 2, e.Bounds.Height - 2 * 2); if (!text.Contains('\n')) { renderer.DrawText(e.Graphics, rendererBounds, text); } else { var lines = text.Split('\n').Select(l => l.Trim()); var first = lines.First(); var otherLines = Environment.NewLine + String.Join(Environment.NewLine, lines.Skip(1).ToArray()); // Draw the first line. using (var boldFont = new Font(font, FontStyle.Bold)) { e.Graphics.DrawString(first, boldFont, textBrush, rendererBounds.X - 1, rendererBounds.Y - 1); } renderer.DrawText(e.Graphics, rendererBounds, otherLines, false /*drawDisabled*/, TextFormatFlags.Left); } } } else { // Fall back to non-visual style drawing. e.DrawBackground(); e.DrawBorder(); using (var sf = new StringFormat()) { sf.LineAlignment = StringAlignment.Center; e.Graphics.DrawString(e.ToolTipText, SystemFonts.DialogFont, Brushes.Black, e.Bounds, sf); } } }
private static Color DefaultTextColor(GroupBoxState state) { if (RenderWithVisualStyles) { InitializeRenderer((int)state); return(visualStyleRenderer.GetColor(ColorProperty.TextColor)); } return(SystemColors.ControlText); }
protected override void OnReadOnlyChanged(EventArgs e) { if (this.ReadOnly) { VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.TextBox.TextEdit.Normal); this.BackColor = renderer.GetColor(ColorProperty.FillColor); } base.OnReadOnlyChanged(e); }
public static void DrawHeader(Graphics g, Rectangle bounds, string headerText, Font font, TextFormatFlags flags, HeaderItemState state) { Color text; if (RenderWithVisualStyles) { InitializeRenderer((int)state); visualStyleRenderer.DrawBackground(g, bounds); text = visualStyleRenderer.GetColor(ColorProperty.TextColor); } else { ControlPaint.DrawButton(g, bounds, ConvertToButtonState(state)); text = SystemColors.ControlText; } TextRenderer.DrawText(g, headerText, font, Rectangle.Inflate(bounds, -3, -3), text, flags); }
protected override void OnControlAdded(ControlEventArgs e) { if (e.Control is ControlPanelTaskLink) { (e.Control as ControlPanelTaskLink).NormalColor = _renderer.GetColor(ColorProperty.TextColor); } base.OnControlAdded(e); }
private void SetLayout() { if (isMin6 && Application.RenderWithVisualStyles) { VisualStyleRenderer theme; using (Graphics g = this.CreateGraphics()) { // Back button theme = new VisualStyleRenderer(VisualStyleElementEx.Navigation.BackButton.Normal); Size bbSize = theme.GetPartSize(g, ThemeSizeType.Draw); // Title theme.SetParameters(VisualStyleElementEx.AeroWizard.TitleBar.Active); titleBar.Height = Math.Max(theme.GetMargins2(g, MarginProperty.ContentMargins).Top, bbSize.Height + 2); titleBar.ColumnStyles[0].Width = bbSize.Width + 4F; titleBar.ColumnStyles[1].Width = titleImageIcon != null ? titleImageList.ImageSize.Width + 4F : 0; backButton.Size = bbSize; // Header theme.SetParameters(VisualStyleElementEx.AeroWizard.HeaderArea.Normal); headerLabel.Margin = theme.GetMargins2(g, MarginProperty.ContentMargins); headerLabel.ForeColor = theme.GetColor(ColorProperty.TextColor); // Content theme.SetParameters(VisualStyleElementEx.AeroWizard.ContentArea.Normal); this.BackColor = theme.GetColor(ColorProperty.FillColor); Padding cp = theme.GetMargins2(g, MarginProperty.ContentMargins); contentArea.ColumnStyles[0].Width = cp.Left; contentArea.RowStyles[1].Height = cp.Bottom; // Command theme.SetParameters(VisualStyleElementEx.AeroWizard.CommandArea.Normal); cp = theme.GetMargins2(g, MarginProperty.ContentMargins); commandArea.RowStyles[0].Height = cp.Top; commandArea.RowStyles[2].Height = cp.Bottom; commandArea.ColumnStyles[2].Width = contentArea.ColumnStyles[2].Width = cp.Right; } } else { backButton.Size = new Size(Properties.Resources.BackBtnStrip.Width, Properties.Resources.BackBtnStrip.Height / 4); } }
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) { if (e.Item.IsOnDropDown && IsSupported) { var renderer = new VisualStyleRenderer("menu", 14, GetItemState(e.Item)); e.TextColor = renderer.GetColor(ColorProperty.TextColor); } base.OnRenderItemText(e); }
/// <summary> /// Draws the border for the dropdown form and the sizegrip in the lower right corner /// </summary> /// <param name="g"></param> private void DrawBorder(Graphics g) { VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.TextBox.TextEdit.Normal); Rectangle borderRect = this.ClientRectangle; borderRect.Width -= 1; borderRect.Height -= 1; g.DrawRectangle(new Pen(renderer.GetColor(ColorProperty.BorderColor)), borderRect); renderer = new VisualStyleRenderer(VisualStyleElement.Status.Gripper.Normal); renderer.DrawBackground(g, _sizeGripRectangle); }
//=------------------------------------------------------------------= // colorCollapseButtonBorder //=------------------------------------------------------------------= /// <summary> /// Returns the color of the pen for the border of the collaps /// button on the caption bar. /// </summary> /// private Color colorCollapseButtonBorder() { if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer vsr; vsr = new VisualStyleRenderer(VisualStyleElement.ExplorerBar.NormalGroupHead.Normal); return(vsr.GetColor(ColorProperty.BorderColorHint)); } else { return(Color.CadetBlue); } }
/// <summary> /// RadioGroupBox public constructor. /// </summary> public RadioGroupBox() { this.InitializeComponent(); this.m_bDisableChildrenIfUnchecked = false; this.m_radioButton.Parent = this; this.m_radioButton.Location = new System.Drawing.Point(RADIOBUTTON_X_OFFSET, RADIOBUTTON_Y_OFFSET); this.Checked = false; // Set the color of the RadioButon's text to the color of the label in a standard groupbox control. VisualStyleRenderer vsr = new VisualStyleRenderer(VisualStyleElement.Button.GroupBox.Normal); Color groupBoxTextColor = vsr.GetColor(ColorProperty.TextColor); this.m_radioButton.ForeColor = groupBoxTextColor; }
//=------------------------------------------------------------------= // colorCaptionBlendStart //=------------------------------------------------------------------= /// <summary> /// Returns the start color to be used to blend the caption bar. /// </summary> /// private Color colorCaptionBlendStart() { if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer vsr; vsr = new VisualStyleRenderer(VisualStyleElement.ExplorerBar.HeaderBackground.Normal); return(vsr.GetColor(ColorProperty.EdgeHighlightColor)); } else { return(Color.White); } }
/// <summary> /// CheckGroupBox public constructor. /// </summary> public CheckGroupBox() { InitializeComponent(); m_bDisableChildrenIfUnchecked = true; m_checkBox.Parent = this; m_checkBox.Location = new Point(CHECKBOX_X_OFFSET, CHECKBOX_Y_OFFSET); Checked = true; // Set the color of the CheckBox's text to the color of the label in a standard groupbox control. var vsr = new VisualStyleRenderer(VisualStyleElement.Button.GroupBox.Normal); Color groupBoxTextColor = vsr.GetColor(ColorProperty.TextColor); m_checkBox.ForeColor = groupBoxTextColor; }
//=------------------------------------------------------------------= // colorCaptionBlendFinish //=------------------------------------------------------------------= /// <summary> /// Returns the finish color to be used to blend the caption bar. /// </summary> /// private Color colorCaptionBlendFinish() { if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer vsr; vsr = new VisualStyleRenderer(VisualStyleElement.ExplorerBar.NormalGroupHead.Normal); return(vsr.GetColor(ColorProperty.GradientColor1)); } else { return(Color.CadetBlue); } }