4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 // Copyright (c) 2006 Jonathan Pobst
26 // Jonathan Pobst (monkey@jpobst.com)
32 using System
.ComponentModel
;
33 using System
.Runtime
.InteropServices
;
34 using System
.Windows
.Forms
.Design
;
36 namespace System
.Windows
.Forms
38 [ToolStripItemDesignerAvailability (ToolStripItemDesignerAvailability
.StatusStrip
)]
39 public class ToolStripStatusLabel
: ToolStripLabel
41 private ToolStripStatusLabelBorderSides border_sides
;
42 private Border3DStyle border_style
;
45 #region Public Constructors
46 public ToolStripStatusLabel ()
47 : this (String
.Empty
, null, null, String
.Empty
)
51 public ToolStripStatusLabel (Image image
)
52 : this (String
.Empty
, image
, null, String
.Empty
)
56 public ToolStripStatusLabel (string text
)
57 : this (text
, null, null, String
.Empty
)
61 public ToolStripStatusLabel (string text
, Image image
)
62 : this (text
, image
, null, String
.Empty
)
66 public ToolStripStatusLabel (string text
, Image image
, EventHandler onClick
)
67 : this (text
, image
, onClick
, String
.Empty
)
71 public ToolStripStatusLabel (string text
, Image image
, EventHandler onClick
, string name
)
72 : base (text
, image
, false, onClick
, name
)
74 this.border_style
= Border3DStyle
.Flat
;
78 #region Public Properties
80 [EditorBrowsable (EditorBrowsableState
.Advanced
)]
81 public new ToolStripItemAlignment Alignment
{
82 get { return base.Alignment; }
83 set { base.Alignment = value; }
86 [DefaultValue (ToolStripStatusLabelBorderSides
.None
)]
87 public ToolStripStatusLabelBorderSides BorderSides
{
88 get { return this.border_sides; }
89 set { this.border_sides = value; }
92 [DefaultValue (Border3DStyle
.Flat
)]
93 public Border3DStyle BorderStyle
{
94 get { return this.border_style; }
95 set { this.border_style = value; }
98 [MonoTODO ("Stub, doesn't affect sizing yet")]
99 [DefaultValue (false)]
101 get { return this.spring; }
102 set { this.spring = value; }
106 #region Protected Properties
107 protected internal override Padding DefaultMargin
{
108 get { return new Padding (0, 3, 0, 2); }
112 #region Public Methods
113 public override Size
GetPreferredSize (Size constrainingSize
)
115 return base.GetPreferredSize (constrainingSize
);
119 #region Protected Methods
120 protected override void OnPaint (PaintEventArgs e
)