Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Utils/Styling/PenStyle.cs @ 4068

Last change on this file since 4068 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 4.5 KB
Line 
1using System.Drawing;
2using System.Drawing.Drawing2D;
3
4namespace Netron.Diagramming.Core {
5  // ----------------------------------------------------------------------
6  /// <summary>
7  /// Basic <see cref="IPenStyle"/> implementation; this is the minimal
8  /// structure for a pen, add other <see cref="Pen"/> properties as needed.
9  /// </summary>
10  // ----------------------------------------------------------------------
11  public partial class PenStyle : IPenStyle {
12    #region Fields
13
14    // ------------------------------------------------------------------
15    /// <summary>
16    /// Implementation of IVersion - the current version of
17    /// PenStyle.
18    /// </summary>
19    // ------------------------------------------------------------------
20    protected const double penStyleVersion = 1.0;
21
22    // -------------------------------------------------------------------
23    /// <summary>
24    /// the pen's color
25    /// </summary>
26    // -------------------------------------------------------------------
27    private Color mColor = Color.Gray;
28
29    // -------------------------------------------------------------------
30    /// <summary>
31    /// the dashstyle of the pen
32    /// </summary>
33    // -------------------------------------------------------------------
34    private DashStyle mDashStyle = DashStyle.Solid;
35
36    // -------------------------------------------------------------------
37    /// <summary>
38    /// the pen's width
39    /// </summary>
40    // -------------------------------------------------------------------
41    private float mWidth = 1F;
42
43    #endregion
44
45    #region Properties
46
47    // ------------------------------------------------------------------
48    /// <summary>
49    /// Gets the current version.
50    /// </summary>
51    // ------------------------------------------------------------------
52    public virtual double Version {
53      get {
54        return penStyleVersion;
55      }
56    }
57
58    // -------------------------------------------------------------------
59    /// <summary>
60    /// Gets or sets the color.
61    /// </summary>
62    /// <value>The color.</value>
63    // -------------------------------------------------------------------
64    public Color Color {
65      get {
66        return mColor;
67      }
68      set {
69        mColor = value;
70      }
71    }
72
73    // -------------------------------------------------------------------
74    /// <summary>
75    /// Gets or sets the dash style.
76    /// </summary>
77    /// <value>The dash style.</value>
78    // -------------------------------------------------------------------
79    public DashStyle DashStyle {
80      get {
81        return mDashStyle;
82      }
83      set {
84        mDashStyle = value;
85      }
86    }
87
88    // -------------------------------------------------------------------
89    /// <summary>
90    /// Gets or sets the width.
91    /// </summary>
92    /// <value>The width.</value>
93    // -------------------------------------------------------------------
94    public float Width {
95      get {
96        return mWidth;
97      }
98      set {
99        mWidth = value;
100      }
101    }
102
103    #endregion
104
105    #region Constructors
106
107    // -------------------------------------------------------------------
108    /// <summary>
109    /// Initializes a new instance of the <see cref="T:PenStyle"/> class.
110    /// </summary>
111    // -------------------------------------------------------------------
112    public PenStyle() { }
113
114    // -------------------------------------------------------------------
115    /// <summary>
116    /// Initializes a new instance of the <see cref="T:PenStyle"/> class.
117    /// </summary>
118    /// <param name="color">The color.</param>
119    /// <param name="dashStyle">The dash style.</param>
120    /// <param name="width">The width.</param>
121    // -------------------------------------------------------------------
122    public PenStyle(Color color, DashStyle dashStyle, float width) {
123      this.mColor = color;
124      this.mWidth = width;
125      this.mDashStyle = dashStyle;
126    }
127
128    #endregion
129
130    #region Methods
131
132    // -------------------------------------------------------------------
133    /// <summary>
134    /// Returns the constructed pen.
135    /// </summary>
136    /// <returns>Pen</returns>
137    // -------------------------------------------------------------------
138    public virtual Pen DrawingPen() {
139      Pen pen = new Pen(mColor, mWidth);
140      pen.DashStyle = mDashStyle;
141      return pen;
142    }
143    #endregion
144  }
145}
Note: See TracBrowser for help on using the repository browser.