2 // System.Drawing.SystemPens.cs
5 // Miguel de Icaza (miguel@ximian.com)
6 // Ravindra (rkumar@novell.com)
7 // Jordi Mas i Hernandez <jordimash@gmail.com>
9 // Copyright (C) 2003-2005 Novell, Inc. http://www.novell.com
13 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
15 // Permission is hereby granted, free of charge, to any person obtaining
16 // a copy of this software and associated documentation files (the
17 // "Software"), to deal in the Software without restriction, including
18 // without limitation the rights to use, copy, modify, merge, publish,
19 // distribute, sublicense, and/or sell copies of the Software, and to
20 // permit persons to whom the Software is furnished to do so, subject to
21 // the following conditions:
23 // The above copyright notice and this permission notice shall be
24 // included in all copies or substantial portions of the Software.
26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 namespace System
.Drawing
39 public sealed class SystemPens
41 static private Pen active_caption_text
;
42 static private Pen control
;
43 static private Pen control_dark
;
44 static private Pen control_dark_dark
;
45 static private Pen control_light
;
46 static private Pen control_light_light
;
47 static private Pen control_text
;
48 static private Pen gray_text
;
49 static private Pen highlight
;
50 static private Pen highlight_text
;
51 static private Pen inactive_caption_text
;
52 static private Pen info_text
;
53 static private Pen menu_text
;
54 static private Pen window_frame
;
55 static private Pen window_text
;
57 static private Pen active_border
;
58 static private Pen active_caption
;
59 static private Pen app_workspace
;
60 static private Pen button_face
;
61 static private Pen button_highlight
;
62 static private Pen button_shadow
;
63 static private Pen desktop
;
64 static private Pen gradient_activecaption
;
65 static private Pen gradient_inactivecaption
;
66 static private Pen hot_track
;
67 static private Pen inactive_border
;
68 static private Pen inactive_caption
;
69 static private Pen info
;
70 static private Pen menu
;
71 static private Pen menu_bar
;
72 static private Pen menu_highlight
;
73 static private Pen scroll_bar
;
74 static private Pen window
;
77 private SystemPens () { }
79 public static Pen ActiveCaptionText
{
81 if (active_caption_text
== null) {
82 active_caption_text
= new Pen (SystemColors
.ActiveCaptionText
);
83 active_caption_text
.isModifiable
= false;
86 return active_caption_text
;
90 public static Pen Control
{
92 if (control
== null) {
93 control
= new Pen (SystemColors
.Control
);
94 control
.isModifiable
= false;
101 public static Pen ControlDark
{
103 if (control_dark
== null) {
104 control_dark
= new Pen (SystemColors
.ControlDark
);
105 control_dark
.isModifiable
= false;
112 public static Pen ControlDarkDark
{
114 if (control_dark_dark
== null) {
115 control_dark_dark
= new Pen (SystemColors
.ControlDarkDark
);
116 control_dark_dark
.isModifiable
= false;
119 return control_dark_dark
;
123 public static Pen ControlLight
{
125 if (control_light
== null) {
126 control_light
= new Pen (SystemColors
.ControlLight
);
127 control_light
.isModifiable
= false;
130 return control_light
;
134 public static Pen ControlLightLight
{
136 if (control_light_light
== null) {
137 control_light_light
= new Pen (SystemColors
.ControlLightLight
);
138 control_light_light
.isModifiable
= false;
141 return control_light_light
;
145 public static Pen ControlText
{
147 if (control_text
== null) {
148 control_text
= new Pen (SystemColors
.ControlText
);
149 control_text
.isModifiable
= false;
156 public static Pen GrayText
{
158 if (gray_text
== null) {
159 gray_text
= new Pen (SystemColors
.GrayText
);
160 gray_text
.isModifiable
= false;
167 public static Pen Highlight
{
169 if (highlight
== null) {
170 highlight
= new Pen (SystemColors
.Highlight
);
171 highlight
.isModifiable
= false;
178 public static Pen HighlightText
{
180 if (highlight_text
== null) {
181 highlight_text
= new Pen (SystemColors
.HighlightText
);
182 highlight_text
.isModifiable
= false;
185 return highlight_text
;
189 public static Pen InactiveCaptionText
{
191 if (inactive_caption_text
== null) {
192 inactive_caption_text
= new Pen (SystemColors
.InactiveCaptionText
);
193 inactive_caption_text
.isModifiable
= false;
196 return inactive_caption_text
;
200 public static Pen InfoText
{
202 if (info_text
== null) {
203 info_text
= new Pen (SystemColors
.InfoText
);
204 info_text
.isModifiable
= false;
211 public static Pen MenuText
{
213 if (menu_text
== null) {
214 menu_text
= new Pen (SystemColors
.MenuText
);
215 menu_text
.isModifiable
= false;
222 public static Pen WindowFrame
{
224 if (window_frame
== null) {
225 window_frame
= new Pen (SystemColors
.WindowFrame
);
226 window_frame
.isModifiable
= false;
233 public static Pen WindowText
{
235 if (window_text
== null) {
236 window_text
= new Pen (SystemColors
.WindowText
);
237 window_text
.isModifiable
= false;
244 public static Pen
FromSystemColor (Color c
)
246 if (c
.IsSystemColor
) {
247 Pen newPen
= new Pen (c
);
248 newPen
.isModifiable
= false;
252 String message
= String
.Format ("The color {0} is not a system color.", c
);
253 throw new ArgumentException (message
);
257 public static Pen ActiveBorder
{
259 if (active_border
== null) {
260 active_border
= new Pen (SystemColors
.ActiveBorder
);
261 active_border
.isModifiable
= false;
264 return active_border
;
268 public static Pen ActiveCaption
{
270 if (active_caption
== null) {
271 active_caption
= new Pen (SystemColors
.ActiveCaption
);
272 active_caption
.isModifiable
= false;
275 return active_caption
;
279 public static Pen AppWorkspace
{
281 if (app_workspace
== null) {
282 app_workspace
= new Pen (SystemColors
.AppWorkspace
);
283 app_workspace
.isModifiable
= false;
286 return app_workspace
;
290 public static Pen ButtonFace
{
292 if (button_face
== null) {
293 button_face
= new Pen (SystemColors
.ButtonFace
);
294 button_face
.isModifiable
= false;
301 public static Pen ButtonHighlight
{
303 if (button_highlight
== null) {
304 button_highlight
= new Pen (SystemColors
.ButtonHighlight
);
305 button_highlight
.isModifiable
= false;
308 return button_highlight
;
312 public static Pen ButtonShadow
{
314 if (button_shadow
== null) {
315 button_shadow
= new Pen (SystemColors
.ButtonShadow
);
316 button_shadow
.isModifiable
= false;
319 return button_shadow
;
323 public static Pen Desktop
{
325 if (desktop
== null) {
326 desktop
= new Pen (SystemColors
.Desktop
);
327 desktop
.isModifiable
= false;
334 public static Pen GradientActiveCaption
{
336 if (gradient_activecaption
== null) {
337 gradient_activecaption
= new Pen (SystemColors
.GradientActiveCaption
);
338 gradient_activecaption
.isModifiable
= false;
341 return gradient_activecaption
;
345 public static Pen GradientInactiveCaption
{
347 if (gradient_inactivecaption
== null) {
348 gradient_inactivecaption
= new Pen (SystemColors
.GradientInactiveCaption
);
349 gradient_inactivecaption
.isModifiable
= false;
352 return gradient_inactivecaption
;
356 public static Pen HotTrack
{
358 if (hot_track
== null) {
359 hot_track
= new Pen (SystemColors
.HotTrack
);
360 hot_track
.isModifiable
= false;
367 public static Pen InactiveBorder
{
369 if (inactive_border
== null) {
370 inactive_border
= new Pen (SystemColors
.InactiveBorder
);
371 inactive_border
.isModifiable
= false;
374 return inactive_border
;
378 public static Pen InactiveCaption
{
380 if (inactive_caption
== null) {
381 inactive_caption
= new Pen (SystemColors
.InactiveCaption
);
382 inactive_caption
.isModifiable
= false;
385 return inactive_caption
;
389 public static Pen Info
{
392 info
= new Pen (SystemColors
.Info
);
393 info
.isModifiable
= false;
400 public static Pen Menu
{
403 menu
= new Pen (SystemColors
.Menu
);
404 menu
.isModifiable
= false;
411 public static Pen MenuBar
{
413 if (menu_bar
== null) {
414 menu_bar
= new Pen (SystemColors
.MenuBar
);
415 menu_bar
.isModifiable
= false;
422 public static Pen MenuHighlight
{
424 if (menu_highlight
== null) {
425 menu_highlight
= new Pen (SystemColors
.MenuHighlight
);
426 menu_highlight
.isModifiable
= false;
429 return menu_highlight
;
433 public static Pen ScrollBar
{
435 if (scroll_bar
== null) {
436 scroll_bar
= new Pen (SystemColors
.ScrollBar
);
437 scroll_bar
.isModifiable
= false;
444 public static Pen Window
{
446 if (window
== null) {
447 window
= new Pen (SystemColors
.Window
);
448 window
.isModifiable
= false;