view Windows/Forms/ColorableStatusBarPanel.cs @ 1:258ef411e698

Remove Tag property that has been added in .Net 2.0 no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sat, 27 Dec 2008 18:32:23 +0000
parents d860e2c49f43
children 1acdb0aff4a7
line wrap: on
line source

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace IBBoard.Windows.Forms
{
	/// <summary>
	/// Summary description for ColourableStatusBarPanel.
	/// </summary>
	public class ColorableStatusBarPanel : StatusBarPanel
	{
		//Note: We keep all external references consistant with .Net and use the American spelling of Colour
		private Color textColour;
		private SolidBrush brush;

		public ColorableStatusBarPanel() : base()
		{
			this.Style = StatusBarPanelStyle.OwnerDraw;
			textColour = SystemColors.WindowText;
			brush = new SolidBrush(textColour);
		}

		public Color Color
		{
			get { return textColour; }
			set 
			{
				textColour = value;
				brush.Color = value;
			}
		}

		public Brush Brush
		{
			get { return brush; }
		}

		public void ResetColor()
		{
			Color = SystemColors.WindowText;
		}

		public string TagString
		{
			get { return (Tag == null ? "" : Tag.ToString()); }
		}
	}
}