2 // System.Drawing.SystemPens.cs
5 // Miguel de Icaza (miguel@ximian.com)
6 // Ravindra (rkumar@novell.com)
8 // Copyright (C) 2003-2004 Novell, Inc. http://www.novell.com
12 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 namespace System
.Drawing
38 public sealed class SystemPens
40 static private Pen active_caption_text
;
41 static private Pen control
;
42 static private Pen control_dark
;
43 static private Pen control_dark_dark
;
44 static private Pen control_light
;
45 static private Pen control_light_light
;
46 static private Pen control_text
;
47 static private Pen gray_text
;
48 static private Pen highlight
;
49 static private Pen highlight_text
;
50 static private Pen inactive_caption_text
;
51 static private Pen info_text
;
52 static private Pen menu_text
;
53 static private Pen window_frame
;
54 static private Pen window_text
;
56 private SystemPens () { }
58 public static Pen ActiveCaptionText
{
60 if (active_caption_text
== null) {
61 active_caption_text
= new Pen (SystemColors
.ActiveCaptionText
);
62 active_caption_text
.isModifiable
= false;
65 return active_caption_text
;
69 public static Pen Control
{
71 if (control
== null) {
72 control
= new Pen (SystemColors
.Control
);
73 control
.isModifiable
= false;
80 public static Pen ControlDark
{
82 if (control_dark
== null) {
83 control_dark
= new Pen (SystemColors
.ControlDark
);
84 control_dark
.isModifiable
= false;
91 public static Pen ControlDarkDark
{
93 if (control_dark_dark
== null) {
94 control_dark_dark
= new Pen (SystemColors
.ControlDarkDark
);
95 control_dark_dark
.isModifiable
= false;
98 return control_dark_dark
;
102 public static Pen ControlLight
{
104 if (control_light
== null) {
105 control_light
= new Pen (SystemColors
.ControlLight
);
106 control_light
.isModifiable
= false;
109 return control_light
;
113 public static Pen ControlLightLight
{
115 if (control_light_light
== null) {
116 control_light_light
= new Pen (SystemColors
.ControlLightLight
);
117 control_light_light
.isModifiable
= false;
120 return control_light_light
;
124 public static Pen ControlText
{
126 if (control_text
== null) {
127 control_text
= new Pen (SystemColors
.ControlText
);
128 control_text
.isModifiable
= false;
135 public static Pen GrayText
{
137 if (gray_text
== null) {
138 gray_text
= new Pen (SystemColors
.GrayText
);
139 gray_text
.isModifiable
= false;
146 public static Pen Highlight
{
148 if (highlight
== null) {
149 highlight
= new Pen (SystemColors
.Highlight
);
150 highlight
.isModifiable
= false;
157 public static Pen HighlightText
{
159 if (highlight_text
== null) {
160 highlight_text
= new Pen (SystemColors
.HighlightText
);
161 highlight_text
.isModifiable
= false;
164 return highlight_text
;
168 public static Pen InactiveCaptionText
{
170 if (inactive_caption_text
== null) {
171 inactive_caption_text
= new Pen (SystemColors
.InactiveCaptionText
);
172 inactive_caption_text
.isModifiable
= false;
175 return inactive_caption_text
;
179 public static Pen InfoText
{
181 if (info_text
== null) {
182 info_text
= new Pen (SystemColors
.InfoText
);
183 info_text
.isModifiable
= false;
190 public static Pen MenuText
{
192 if (menu_text
== null) {
193 menu_text
= new Pen (SystemColors
.MenuText
);
194 menu_text
.isModifiable
= false;
201 public static Pen WindowFrame
{
203 if (window_frame
== null) {
204 window_frame
= new Pen (SystemColors
.WindowFrame
);
205 window_frame
.isModifiable
= false;
212 public static Pen WindowText
{
214 if (window_text
== null) {
215 window_text
= new Pen (SystemColors
.WindowText
);
216 window_text
.isModifiable
= false;
223 public static Pen
FromSystemColor (Color c
)
225 if (c
.IsSystemColor
) {
226 Pen newPen
= new Pen (c
);
227 newPen
.isModifiable
= false;
231 String message
= String
.Format ("The color {0} is not a system color.", c
);
232 throw new ArgumentException (message
);