view Windows/Forms/ColorableStatusBarPanel.cs @ 0:d860e2c49f43

Initial commit of IBBoard libraries
author IBBoard <dev@ibboard.co.uk>
date Fri, 19 Dec 2008 11:13:48 +0000
parents
children 258ef411e698
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;
		private object tag;

		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 object Tag
		{
			get { return tag; }
			set { tag = value; }
		}

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