/// <summary>
        /// CheckGroupBox public constructor.
        /// </summary>
        public CheckGroupBox()
        {
            this.InitializeComponent();
            this.m_bDisableChildrenIfUnchecked = true;
            this.m_checkBox.Parent = this;
            this.m_checkBox.Location = new System.Drawing.Point(CHECKBOX_X_OFFSET, CHECKBOX_Y_OFFSET);
            this.Checked = true;

            // Set the color of the CheckBox'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_checkBox.ForeColor = groupBoxTextColor;
        }
Exemple #2
0
        /// <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;
        }
        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>
        /// 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.
            if (VisualStyleInformation.IsSupportedByOS && VisualStyleInformation.IsEnabledByUser)
            {
                VisualStyleRenderer vsr = new VisualStyleRenderer(VisualStyleElement.Button.GroupBox.Normal);
                Color groupBoxTextColor = vsr.GetColor(ColorProperty.TextColor);
                m_checkBox.ForeColor = groupBoxTextColor;
            }
        }
Exemple #5
0
        /// <summary>
        /// Draws certain tab.
        /// </summary>
        /// <param name="g">The <see cref="System.Drawing.Graphics"/> object used to draw tab control.</param>
        /// <param name="index">Index of the tab being drawn.</param>
        /// <param name="tabRect">The <see cref="System.Drawing.Rectangle"/> object specifying tab bounds.</param>
        /// <param name="rend">The <see cref="System.Windows.Forms.VisualStyles.VisualStyleRenderer"/> object for rendering the tab.</param>
        private void DrawTabItem(Graphics g, int index, Rectangle tabRect, VisualStyleRenderer rend)
        {
            //if 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)
            {
                bool tabSelected = rend.State == (int)TabItemState.Selected;
                /* We will draw our tab on the bitmap and then will transfer image on the control
                 * graphic context.*/
                GDIMemoryContext memGDI = new GDIMemoryContext(g, tabRect.Width, tabRect.Height);
                Rectangle drawRect = new Rectangle(0, 0, tabRect.Width, tabRect.Height);
                using (Graphics bitmapContext = memGDI.CreateGraphics())
                {
                    rend.DrawBackground(bitmapContext, drawRect);
                    if (tabSelected && tabRect.X == 0)
                    {
                        int corrY = memGDI.Height - 1;
                        memGDI.SetPixel(0, corrY, memGDI.GetPixel(0, corrY - 1));
                    }
                    /* Important moment. If tab alignment is bottom we should flip image to display tab
                     * correctly.*/
                    if (this.Alignment == TabAlignment.Bottom) memGDI.FlipVertical();

                    Rectangle focusRect = Rectangle.Inflate(drawRect, -3, -3);//focus rect
                    TabPage pg = this.TabPages[index];//tab page whose tab we're drawing
                    //trying to get 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 = tabSelected ? new Point(8, 2) : new Point(6, 2);
                        if (this.Alignment == TabAlignment.Bottom) imgLoc.Y = drawRect.Bottom - 2 - pagePict.Height;
                        bitmapContext.DrawImageUnscaled(pagePict, imgLoc);
                        //Correcting rectangle for drawing text.
                        drawRect.X += imgLoc.X + pagePict.Width; drawRect.Width -= imgLoc.X + pagePict.Width;
                    }
                    //drawing tab text
                    TextRenderer.DrawText(bitmapContext, pg.Text, this.Font, drawRect, rend.GetColor(ColorProperty.TextColor),
                        TextFormatFlags.SingleLine | TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
                    //and finally drawing focus rect(if needed)
                    if (this.Focused && tabSelected)
                        ControlPaint.DrawFocusRectangle(bitmapContext, focusRect);
                }
                //If the tab has part under scroller we shouldn't draw that part.
                int shift = tabSelected ? 2 : 0;
                if (fUpDown.X > 0 && fUpDown.X >= tabRect.X - shift && fUpDown.X < tabRect.Right + shift)
                    tabRect.Width -= tabRect.Right - fUpDown.X + shift;
                memGDI.DrawContextClipped(g, tabRect);
            }
        }
        /// <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);

            }
        }
Exemple #7
0
		public static void DrawGroupBox (Graphics g, Rectangle bounds, string groupBoxText, Font font, Color textColor, TextFormatFlags flags, GroupBoxState state)
		{
			Size font_size = TextRenderer.MeasureText (groupBoxText, font);

			if (Application.RenderWithVisualStyles || always_use_visual_styles == true) {
				VisualStyleRenderer vsr;
				Rectangle new_bounds;

				switch (state) {
					case GroupBoxState.Normal:
					default:
						vsr = new VisualStyleRenderer (VisualStyleElement.Button.GroupBox.Normal);
						new_bounds = new Rectangle (bounds.Left, bounds.Top + (int)(font_size.Height / 2) - 1, bounds.Width, bounds.Height - (int)(font_size.Height / 2) + 1);
						break;
					case GroupBoxState.Disabled:
						vsr = new VisualStyleRenderer (VisualStyleElement.Button.GroupBox.Disabled);
						new_bounds = new Rectangle (bounds.Left, bounds.Top + (int)(font_size.Height / 2) - 2, bounds.Width, bounds.Height - (int)(font_size.Height / 2) + 2);
						break;
				}

				if (groupBoxText == String.Empty)
					vsr.DrawBackground (g, bounds);
				else
					vsr.DrawBackgroundExcludingArea (g, new_bounds, new Rectangle (bounds.Left + 9, bounds.Top, font_size.Width - 3, font_size.Height));

				if (textColor == Color.Empty)
					textColor = vsr.GetColor (ColorProperty.TextColor);

				if (groupBoxText != String.Empty)
					TextRenderer.DrawText (g, groupBoxText, font, new Point (bounds.Left + 8, bounds.Top), textColor, flags);
			}
			else {
				// MS has a pretty big bug when rendering the non-visual styles group box.  Instead of using the height
				// part of the bounds as height, they use it as the bottom, so the boxes are drawn in completely different
				// places.  Rather than emulate this bug, we do it correctly.  After googling for a while, I don't think
				// anyone has ever actually used this class for anything, so it should be fine.  :)
				Rectangle new_bounds = new Rectangle (bounds.Left, bounds.Top + (int)(font_size.Height / 2), bounds.Width, bounds.Height - (int)(font_size.Height / 2));
				
				// Don't paint over the background where we are going to put the text
				Region old_clip = g.Clip;
				g.SetClip (new Rectangle (bounds.Left + 9, bounds.Top, font_size.Width - 3, font_size.Height), System.Drawing.Drawing2D.CombineMode.Exclude);
				
				ControlPaint.DrawBorder3D (g, new_bounds, Border3DStyle.Etched);
				
				g.Clip = old_clip;

				if (groupBoxText != String.Empty) {
					if (textColor == Color.Empty)
						textColor = state == GroupBoxState.Normal ? SystemColors.ControlText :
							SystemColors.GrayText;
					TextRenderer.DrawText (g, groupBoxText, font, new Point (bounds.Left + 8, bounds.Top), textColor, flags);
				}
			}
		}
Exemple #8
0
        //-------------------------------------------------------------------
        // Private Member Functions
        //-------------------------------------------------------------------
        /// <summary>
        /// Changes any colors on this control as necessary for theme support
        /// </summary>
        private void SetThemeColors()
        {
            // Under Vista or a non-themed system, use fixed colors for everything

            if (s_isVista || !VisualStyleRenderer.IsSupported)
            {
                base.ActiveLinkColor = Color.FromArgb(0x33, 0x99, 0xFF);
                base.LinkColor = Color.FromArgb(0x00, 0x66, 0xD5);
                base.VisitedLinkColor = Color.FromArgb(0x00, 0x66, 0xD5);
                return;
            }

            // XP with themes enabled.  Use the GroupBox text foreground
            // color for all of the various LinkLabel states

            VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.Button.GroupBox.Normal);
            Color textColor = renderer.GetColor(ColorProperty.TextColor);

            base.ActiveLinkColor = textColor;
            base.LinkColor = textColor;
            base.VisitedLinkColor = textColor;
        }
Exemple #9
0
 /// <summary>
 /// Fires the tick drawing events
 /// </summary>
 /// <param name="hdc">The device context that holds the graphics operations</param>
 protected virtual void OnDrawTicks(IntPtr hdc)
 {
     Graphics graphics = Graphics.FromHdc(hdc);
     if (((this.OwnerDrawParts & TrackBarOwnerDrawParts.Ticks) == TrackBarOwnerDrawParts.Ticks) && !this.DesignMode)
     {
         TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ClientRectangle, (TrackBarItemState)this.ThumbState);
         if (this.DrawTicks != null)
         {
             this.DrawTicks(this, e);
         }
     }
     else
     {
         if (this.TickStyle == TickStyle.None)
         {
             return;
         }
         if (this.ThumbBounds.Equals(Rectangle.Empty))
         {
             return;
         }
         Color black = Color.Black;
         if (VisualStyleRenderer.IsSupported)
         {
             VisualStyleRenderer vsr = new VisualStyleRenderer("TRACKBAR", (int)NativeMethods.TrackBarParts.TKP_TICS, ThumbState);
             black = vsr.GetColor(ColorProperty.TextColor);
         }
         if (this.Orientation == Orientation.Horizontal)
         {
             this.DrawHorizontalTicks(graphics, black);
         }
         else
         {
             this.DrawVerticalTicks(graphics, black);
         }
     }
     graphics.Dispose();
 }
		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 OnRenderToolStripBorder(ToolStripRenderEventArgs e)
        {
            Color c = SystemColors.AppWorkspace;
            if (UseVS)
            {
                VisualStyleRenderer rndr = new VisualStyleRenderer(VisualStyleElement.Tab.Pane.Normal);
                c = rndr.GetColor(ColorProperty.BorderColorHint);
            }

            using (Pen p = new Pen(c))
            using (Pen p2 = new Pen(e.BackColor))
            {
                Rectangle r = e.ToolStrip.Bounds;
                int x1 = (Mirrored) ? 0 : r.Width - 1 - e.ToolStrip.Padding.Horizontal;
                int y1 = (Mirrored) ? 0 : r.Height - 1;
                if (e.ToolStrip.Orientation == Orientation.Horizontal)
                    e.Graphics.DrawLine(p, 0, y1, r.Width, y1);
                else
                {
                    e.Graphics.DrawLine(p, x1, 0, x1, r.Height);
                    if (!Mirrored)
                        for (int i = x1 + 1; i < r.Width; i++)
                            e.Graphics.DrawLine(p2, i, 0, i, r.Height);
                }
                foreach (ToolStripItem x in e.ToolStrip.Items)
                {
                    if (x.IsOnOverflow) continue;
                    TabStripButton btn = x as TabStripButton;
                    if (btn == null) continue;
                    Rectangle rc = btn.Bounds;
                    int x2 = (Mirrored) ? rc.Left : rc.Right;
                    int y2 = (Mirrored) ? rc.Top : rc.Bottom - 1;
                    int addXY = (Mirrored) ? 0 : 1;
                    if (e.ToolStrip.Orientation == Orientation.Horizontal)
                    {
                        e.Graphics.DrawLine(p, rc.Left, y2, rc.Right, y2);
                        if (btn.Checked) e.Graphics.DrawLine(p2, rc.Left + 2 - addXY, y2, rc.Right - 2 - addXY, y2);
                    }
                    else
                    {
                        e.Graphics.DrawLine(p, x2, rc.Top, x2, rc.Bottom);
                        if (btn.Checked) e.Graphics.DrawLine(p2, x2, rc.Top + 2 - addXY, x2, rc.Bottom - 2 - addXY);
                    }
                }
            }
        }
Exemple #12
0
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="e">
        /// A <see cref="PaintEventArgs"/> that contains the event data.
        /// </param>
        protected override void OnPaint(PaintEventArgs e)
        {
            int width = this.ClientRectangle.Width;
            string text = this.Text;
            Font font = this.Font;
            bool isRightToLeft = (this.RightToLeft == RightToLeft.Yes);
            TextFormatFlags formatFlags = TextFormatFlags.SingleLine | TextFormatFlags.WordEllipsis | TextFormatFlags.GlyphOverhangPadding;

            if (!this.ShowKeyboardCues)
            {
                formatFlags |= TextFormatFlags.HidePrefix;
            }

            if (isRightToLeft)
            {
                formatFlags |= TextFormatFlags.Right | TextFormatFlags.RightToLeft;
            }

            Size TextSize = TextRenderer.MeasureText(e.Graphics, text, font, new Size(width, 18), formatFlags);
            int TextMidline = TextSize.Height >> 1;

            bool DrawLine = (TextSize.Width + 32) < width;

            Rectangle TextBounds;

            if (isRightToLeft)
            {
                TextBounds = new Rectangle(width - TextSize.Width, 0, TextSize.Width, TextSize.Height);
            }
            else
            {
                TextBounds = new Rectangle(0, 0, TextSize.Width, TextSize.Height);
            }

            if (Application.RenderWithVisualStyles)
            {
                VisualStyleRenderer Renderer = new VisualStyleRenderer((this.Enabled) ? VisualStyleElement.Button.GroupBox.Normal : VisualStyleElement.Button.GroupBox.Disabled);

                TextRenderer.DrawText(e.Graphics, text, font, TextBounds, Renderer.GetColor(ColorProperty.TextColor), formatFlags);

                if (DrawLine)
                {
                    if (isRightToLeft)
                    {
                        e.Graphics.DrawLine(SystemPens.ActiveBorder, 4, TextMidline, width - TextSize.Width, TextMidline);
                    }
                    else
                    {
                        e.Graphics.DrawLine(SystemPens.ActiveBorder, TextSize.Width, TextMidline, width - 4, TextMidline);
                    }
                }
            }
            else
            {
                if (this.Enabled)
                {
                    TextRenderer.DrawText(e.Graphics, text, font, TextBounds, SystemColors.ControlText, formatFlags);
                }
                else
                {
                    TextRenderer.DrawText(e.Graphics, text, font, new Rectangle(TextBounds.X + 1, TextBounds.Y + 1, TextBounds.Width, TextBounds.Height), SystemColors.ControlLightLight, formatFlags);
                    TextRenderer.DrawText(e.Graphics, text, font, TextBounds, SystemColors.GrayText, formatFlags);
                }

                if (DrawLine)
                {
                    if (isRightToLeft)
                    {
                        e.Graphics.DrawLine(SystemPens.GrayText, 4, TextMidline, width - TextSize.Width, TextMidline);
                        e.Graphics.DrawLine(SystemPens.ControlLightLight, 4, TextMidline + 1, width - TextSize.Width, TextMidline + 1);
                    }
                    else
                    {
                        e.Graphics.DrawLine(SystemPens.GrayText, TextSize.Width, TextMidline, width - 4, TextMidline);
                        e.Graphics.DrawLine(SystemPens.ControlLightLight, TextSize.Width, TextMidline + 1, width - 4, TextMidline + 1);
                    }
                }
            }

            base.OnPaint(e);
        }
		private void GetThemeColors()
		{
			Color selectColor = new Color(); 
			Color focusColor = new Color();
			Color borderColor = new Color();
			Color itemColor = new Color();
	        bool useSystemColors = false;

            VisualStyleElement element;
            
			// Check if visual styles are used
			if (Application.RenderWithVisualStyles) 
         	{
                             
                // Get Theme colors..
                element = VisualStyleElement.ExplorerBar.HeaderBackground.Normal;
                VisualStyleRenderer renderer = new VisualStyleRenderer(element); 
                selectColor = renderer.GetColor(ColorProperty.GradientColor2);
                
                itemColor = selectColor;
                borderColor = ControlPaint.Light(selectColor);
                selectColor = ControlPaint.Light(selectColor);
                focusColor = ControlPaint.Light(selectColor);
            }
			else
			{
				useSystemColors = true;
			}

			if (useSystemColors)
			{
				// Get System colors
				selectColor = SystemColors.ActiveCaption;  		
				focusColor = ControlPaint.Light(selectColor); 		
				borderColor = SystemColors.ActiveBorder;
				itemColor = selectColor;
			}

			// apply colors..
			
			m_month.Colors.Selected.Border = ControlPaint.Light(ControlPaint.Dark(selectColor));
			this.BorderColor = borderColor;
										 
			m_month.Colors.Selected.BackColor = selectColor;
			m_month.Colors.Focus.BackColor = focusColor;
			m_month.Colors.Focus.Border = selectColor;
			m_header.BackColor1 = itemColor;
			m_weekday.TextColor = itemColor;
			m_weekday.BackColor1 = Color.White; 
			m_weeknumber.TextColor = itemColor;
			m_weeknumber.BackColor1 = Color.White; 
                       
			Invalidate();

		}
        //-------------------------------------------------------------------
        // Private Member Functions
        //-------------------------------------------------------------------
        /// <summary>
        /// Changes any colors on this control as necessary for theme support
        /// </summary>
        private void SetThemeColors()
        {
            // Under Vista or a non-themed system, use a fixed foreground color

            if (s_isVista || !VisualStyleRenderer.IsSupported)
            {
                base.ForeColor = Color.FromArgb(0x00, 0x33, 0x99);
                return;
            }

            // XP with themes enabled.  Use the GroupBox text foreground color

            VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.Button.GroupBox.Normal);
            base.ForeColor = renderer.GetColor(ColorProperty.TextColor);
        }