view Windows/Forms/ColorableStatusBarPanel.cs @ 7:02a7c7aaf2c1

* Fix line terminators no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sat, 27 Jun 2009 19:03:23 +0000
parents 1acdb0aff4a7
children
line wrap: on
line source

// This file (ColorableStatusBar.cs) is a part of the IBBoard.Windows.Forms library and is copyright 2009 IBBoard.
//
// The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.

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()); }
		}
	}
}