Mercurial > repos > IBBoard.Windows.Forms
annotate Windows/Forms/ColorableStatusBar.cs @ 21:031354c2a34c default tip
* Add Hyperlink that does sensible stuff by default
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 19 May 2012 16:45:19 +0100 |
parents | 02a7c7aaf2c1 |
children |
rev | line source |
---|---|
4
1acdb0aff4a7
Re #8 - LGPL license all libraries
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
1 // This file (ColorableStatusBar.cs) is a part of the IBBoard.Windows.Forms library and is copyright 2009 IBBoard. |
1acdb0aff4a7
Re #8 - LGPL license all libraries
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
2 // |
1acdb0aff4a7
Re #8 - LGPL license all libraries
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
3 // 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. |
1acdb0aff4a7
Re #8 - LGPL license all libraries
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
4 |
7 | 5 using System; |
6 using System.Drawing; | |
7 using System.Drawing.Drawing2D; | |
8 using System.Windows.Forms; | |
9 | |
10 namespace IBBoard.Windows.Forms | |
11 { | |
12 /// <summary> | |
13 /// Summary description for ColorableStatusBar. | |
14 /// </summary> | |
15 public class ColorableStatusBar : StatusBar | |
16 { | |
17 private Brush defaultBrush; | |
18 | |
19 public ColorableStatusBar() | |
20 { | |
21 defaultBrush = new SolidBrush(SystemColors.WindowText); | |
22 } | |
23 | |
24 //Code taken from MS Knowledge base - http://support.microsoft.com/kb/319311 | |
25 public void ColorableStatusBarDrawItem(object sender, StatusBarDrawItemEventArgs sbdevent) | |
26 { | |
27 if (sender is StatusBar) | |
28 { | |
29 System.Drawing.Graphics g = sbdevent.Graphics; | |
30 StatusBar sb = (StatusBar)sender; | |
31 RectangleF rectf = new RectangleF(sbdevent.Bounds.X, sbdevent.Bounds.Y, sbdevent.Bounds.Width, sbdevent.Bounds.Height); | |
32 | |
33 if (sbdevent.Panel is ColorableStatusBarPanel) | |
34 { | |
35 g.DrawString(sbdevent.Panel.Text, sb.Font, ((ColorableStatusBarPanel)sbdevent.Panel).Brush, rectf); | |
36 } | |
37 else | |
38 { | |
39 g.DrawString(sbdevent.Panel.Text, sb.Font, defaultBrush, rectf); | |
40 } | |
41 } | |
42 } | |
43 } | |
44 } |