using System; using System.Text; using System.Drawing; using System.ComponentModel; namespace DevComponents.WinForms.Drawing { public class SolidBorder : Border { #region Constructor /// /// Initializes a new instance of the SolidBorder class. /// /// /// public SolidBorder(Color color, int width) { _Color = color; _Width = width; } /// /// Initializes a new instance of the SolidBorder class. /// /// public SolidBorder(Color color) { _Color = color; } /// /// Initializes a new instance of the SolidBorder class. /// public SolidBorder() { } #endregion #region Internal Implementation /// /// Creates the pen for the border. /// /// Returns pen or null if pen cannot be created. public override Pen CreatePen() { if (!CanCreatePen()) return null; return new Pen(_Color, _Width); } private bool CanCreatePen() { return !_Color.IsEmpty && _Width > 0; } private Color _Color = Color.Empty; /// /// Gets or sets the fill color. /// [Description("Indicates the fill color.")] public Color Color { get { return _Color; } set { _Color = value; } } /// /// Gets whether property should be serialized. /// /// true if property should be serialized [EditorBrowsable(EditorBrowsableState.Never)] public bool ShouldSerializeColor() { return !_Color.IsEmpty; } /// /// Sets the property to its default value. /// [EditorBrowsable(EditorBrowsableState.Never)] public void ResetColor() { Color = Color.Empty; } #endregion } }