using System.Runtime.InteropServices;
namespace System.Windows.Forms {
+#if NET_2_0
+ [ToolboxItem (false)]
+#endif
[DefaultProperty("Text")]
[DesignTimeVisible(false)]
public class StatusBarPanel : Component, ISupportInitialize {
private HorizontalAlignment alignment = HorizontalAlignment.Left;
private StatusBarPanelAutoSize auto_size = StatusBarPanelAutoSize.None;
private StatusBarPanelBorderStyle border_style = StatusBarPanelBorderStyle.Sunken;
- private StatusBarPanelStyle style;
+ private StatusBarPanelStyle style = StatusBarPanelStyle.Text;
private int width = 100;
- private int twidth = -1;
private int min_width = 10;
internal int X;
+
+#if NET_2_0
+ private string name;
+ private object tag;
+#endif
#endregion // Local Variables
#region Constructors
}
}
+#if NET_2_0
+ [RefreshProperties (RefreshProperties.All)]
+#endif
[DefaultValue(StatusBarPanelAutoSize.None)]
public StatusBarPanelAutoSize AutoSize {
get { return auto_size; }
[RefreshProperties(RefreshProperties.All)]
public int MinWidth {
get {
- if (AutoSize == StatusBarPanelAutoSize.None)
- return Width;
+ /*
+ MSDN says that when AutoSize = None then MinWidth is automatically
+ set to Width, but neither v1.1 nor v2.0 behave that way.
+ */
return min_width;
}
set {
+#if NET_2_0
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value");
+#else
if (value < 0)
throw new ArgumentException ("value");
+#endif
min_width = value;
+ if (min_width > width)
+ width = min_width;
+
Invalidate ();
}
}
+#if NET_2_0
+ [Localizable (true)]
+ public string Name {
+ get {
+ if (name == null)
+ return string.Empty;
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+#endif
[DefaultValue(100)]
[Localizable(true)]
throw new ArgumentException ("value");
if (initializing)
- twidth = value;
- else
width = value;
-
+ else
+ SetWidth(value);
+
Invalidate ();
}
}
Invalidate ();
}
}
+#if NET_2_0
+ [TypeConverter (typeof (StringConverter))]
+ [Localizable (false)]
+ [Bindable (true)]
+ [DefaultValue (null)]
+ public object Tag {
+ get {
+ return tag;
+ }
+ set {
+ tag = value;
+ }
+ }
+#endif
[DefaultValue("")]
[Localizable(true)]
internal void SetWidth (int width)
{
this.width = width;
+ if (min_width > this.width)
+ this.width = min_width;
}
public override string ToString ()
public void EndInit ()
{
- if (!initializing || twidth == -1)
+ if (!initializing)
return;
-
- width = twidth;
- twidth = -1;
+
+ if (min_width > width)
+ width = min_width;
+
initializing = false;
}
}