using System.Drawing; using System.Drawing.Drawing2D; namespace Netron.Diagramming.Core { // ---------------------------------------------------------------------- /// /// Basic implementation; this is the minimal /// structure for a pen, add other properties as needed. /// // ---------------------------------------------------------------------- public partial class PenStyle : IPenStyle { #region Fields // ------------------------------------------------------------------ /// /// Implementation of IVersion - the current version of /// PenStyle. /// // ------------------------------------------------------------------ protected const double penStyleVersion = 1.0; // ------------------------------------------------------------------- /// /// the pen's color /// // ------------------------------------------------------------------- private Color mColor = Color.Gray; // ------------------------------------------------------------------- /// /// the dashstyle of the pen /// // ------------------------------------------------------------------- private DashStyle mDashStyle = DashStyle.Solid; // ------------------------------------------------------------------- /// /// the pen's width /// // ------------------------------------------------------------------- private float mWidth = 1F; #endregion #region Properties // ------------------------------------------------------------------ /// /// Gets the current version. /// // ------------------------------------------------------------------ public virtual double Version { get { return penStyleVersion; } } // ------------------------------------------------------------------- /// /// Gets or sets the color. /// /// The color. // ------------------------------------------------------------------- public Color Color { get { return mColor; } set { mColor = value; } } // ------------------------------------------------------------------- /// /// Gets or sets the dash style. /// /// The dash style. // ------------------------------------------------------------------- public DashStyle DashStyle { get { return mDashStyle; } set { mDashStyle = value; } } // ------------------------------------------------------------------- /// /// Gets or sets the width. /// /// The width. // ------------------------------------------------------------------- public float Width { get { return mWidth; } set { mWidth = value; } } #endregion #region Constructors // ------------------------------------------------------------------- /// /// Initializes a new instance of the class. /// // ------------------------------------------------------------------- public PenStyle() { } // ------------------------------------------------------------------- /// /// Initializes a new instance of the class. /// /// The color. /// The dash style. /// The width. // ------------------------------------------------------------------- public PenStyle(Color color, DashStyle dashStyle, float width) { this.mColor = color; this.mWidth = width; this.mDashStyle = dashStyle; } #endregion #region Methods // ------------------------------------------------------------------- /// /// Returns the constructed pen. /// /// Pen // ------------------------------------------------------------------- public virtual Pen DrawingPen() { Pen pen = new Pen(mColor, mWidth); pen.DashStyle = mDashStyle; return pen; } #endregion } }