| 0: | // AxStatusBarPanel.cs | |
| 1: | // Copyright (C) 2001 Mike Krueger | |
| 2: | // | |
| 3: | // This program is free software; you can redistribute it and/or | |
| 4: | // modify it under the terms of the GNU General Public License | |
| 5: | // as published by the Free Software Foundation; either version 2 | |
| 6: | // of the License, or (at your option) any later version. | |
| 7: | // | |
| 8: | // This program is distributed in the hope that it will be useful, | |
| 9: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 10: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 11: | // GNU General Public License for more details. | |
| 12: | // | |
| 13: | // You should have received a copy of the GNU General Public License | |
| 14: | // along with this program; if not, write to the Free Software | |
| 15: | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 16: | ||
| 17: | using System; | |
| 18: | using System.Collections; | |
| 19: | using System.Drawing; | |
| 20: | using System.Windows.Forms; | |
| 21: | ||
| 22: | namespace TimeSprint.Alexandria.UI.StatusBar { | |
| 23: | ||
| 24: | public class AxStatusBarPanel : StatusBarPanel | |
| 25: | { | |
| 26: | StringFormat sFormat = new StringFormat(); | |
| 27: | ||
| 28: | public AxStatusBarPanel() | |
| 29: | { | |
| 30: | Style = StatusBarPanelStyle.OwnerDraw; | |
| 31: | BorderStyle = StatusBarPanelBorderStyle.None; | |
| 32: | } | |
| 33: | ||
| 34: | protected virtual void DrawBorder(StatusBarDrawItemEventArgs drawEventArgs) | |
| 35: | { | |
| 36: | drawEventArgs.Graphics.DrawRectangle(SystemPens.ControlDark, | |
| 37: | new Rectangle(drawEventArgs.Bounds.X, | |
| 38: | drawEventArgs.Bounds.Y, | |
| 39: | drawEventArgs.Bounds.Width - 1, | |
| 40: | drawEventArgs.Bounds.Height - 1)); | |
| 41: | } | |
| 42: | ||
| 43: | public virtual void DrawPanel(StatusBarDrawItemEventArgs drawEventArgs) | |
| 44: | { | |
| 45: | Graphics g = drawEventArgs.Graphics; | |
| 46: | switch (Alignment) { | |
| 47: | case HorizontalAlignment.Left: | |
| 48: | sFormat.Alignment = StringAlignment.Near; | |
| 49: | break; | |
| 50: | case HorizontalAlignment.Center: | |
| 51: | sFormat.Alignment = StringAlignment.Center; | |
| 52: | break; | |
| 53: | case HorizontalAlignment.Right: | |
| 54: | sFormat.Alignment = StringAlignment.Far; | |
| 55: | break; | |
| 56: | } | |
| 57: | g.DrawString(Text, | |
| 58: | drawEventArgs.Font, | |
| 59: | SystemBrushes.ControlText, | |
| 60: | drawEventArgs.Bounds, | |
| 61: | sFormat); | |
| 62: | DrawBorder(drawEventArgs); | |
| 63: | } | |
| 64: | ||
| 65: | protected override void Dispose(bool disposing) | |
| 66: | { | |
| 67: | if (disposing) { | |
| 68: | sFormat.Dispose(); | |
| 69: | } | |
| 70: | } | |
| 71: | } | |
| 72: | } |
This page was automatically generated by SharpDevelop.