2 // System.Drawing.SystemBrushes.cs
5 // Dennis Hayes (dennish@Raytek.com)
6 // Ravindra (rkumar@novell.com)
7 // Jordi Mas i Hernandez <jordimash@gmail.com>
9 // Copyright (C) 2002 Ximian, Inc. http://www.ximian.com
10 // Copyright (C) 2004 Novell, Inc. http://www.novell.com
14 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
16 // Permission is hereby granted, free of charge, to any person obtaining
17 // a copy of this software and associated documentation files (the
18 // "Software"), to deal in the Software without restriction, including
19 // without limitation the rights to use, copy, modify, merge, publish,
20 // distribute, sublicense, and/or sell copies of the Software, and to
21 // permit persons to whom the Software is furnished to do so, subject to
22 // the following conditions:
24 // The above copyright notice and this permission notice shall be
25 // included in all copies or substantial portions of the Software.
27 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 namespace System
.Drawing
41 /// Summary description for SystemBrushes.
43 public sealed class SystemBrushes
45 static SolidBrush active_border
;
46 static SolidBrush active_caption
;
47 static SolidBrush active_caption_text
;
48 static SolidBrush app_workspace
;
49 static SolidBrush control
;
50 static SolidBrush control_dark
;
51 static SolidBrush control_dark_dark
;
52 static SolidBrush control_light
;
53 static SolidBrush control_light_light
;
54 static SolidBrush control_text
;
55 static SolidBrush desktop
;
56 static SolidBrush highlight
;
57 static SolidBrush highlight_text
;
58 static SolidBrush hot_track
;
59 static SolidBrush inactive_border
;
60 static SolidBrush inactive_caption
;
61 static SolidBrush info
;
62 static SolidBrush menu
;
63 static SolidBrush scroll_bar
;
64 static SolidBrush window
;
65 static SolidBrush window_text
;
67 static SolidBrush button_face
;
68 static SolidBrush button_highlight
;
69 static SolidBrush button_shadow
;
70 static SolidBrush gradient_activecaption
;
71 static SolidBrush gradient_inactivecaption
;
72 static SolidBrush graytext
;
73 static SolidBrush inactive_captiontext
;
74 static SolidBrush infotext
;
75 static SolidBrush menubar
;
76 static SolidBrush menu_highlight
;
77 static SolidBrush menu_text
;
78 static SolidBrush window_fame
;
81 private SystemBrushes() { }
83 public static Brush ActiveBorder
86 if (active_border
== null) {
87 active_border
= new SolidBrush (SystemColors
.ActiveBorder
);
88 active_border
.isModifiable
= false;
95 public static Brush ActiveCaption
98 if (active_caption
== null) {
99 active_caption
= new SolidBrush (SystemColors
.ActiveCaption
);
100 active_caption
.isModifiable
= false;
103 return active_caption
;
107 public static Brush ActiveCaptionText
110 if (active_caption_text
== null) {
111 active_caption_text
= new SolidBrush (SystemColors
.ActiveCaptionText
);
112 active_caption_text
.isModifiable
= false;
115 return active_caption_text
;
119 public static Brush AppWorkspace
122 if (app_workspace
== null) {
123 app_workspace
= new SolidBrush (SystemColors
.AppWorkspace
);
124 app_workspace
.isModifiable
= false;
127 return app_workspace
;
131 public static Brush Control
{
133 if (control
== null) {
134 control
= new SolidBrush (SystemColors
.Control
);
135 control
.isModifiable
= false;
142 public static Brush ControlLight
{
144 if (control_light
== null) {
145 control_light
= new SolidBrush (SystemColors
.ControlLight
);
146 control_light
.isModifiable
= false;
149 return control_light
;
153 public static Brush ControlLightLight
{
155 if (control_light_light
== null) {
156 control_light_light
= new SolidBrush (SystemColors
.ControlLightLight
);
157 control_light_light
.isModifiable
= false;
160 return control_light_light
;
164 public static Brush ControlDark
{
166 if (control_dark
== null) {
167 control_dark
= new SolidBrush (SystemColors
.ControlDark
);
168 control_dark
.isModifiable
= false;
175 public static Brush ControlDarkDark
{
177 if (control_dark_dark
== null) {
178 control_dark_dark
= new SolidBrush (SystemColors
.ControlDarkDark
);
179 control_dark_dark
.isModifiable
= false;
182 return control_dark_dark
;
186 public static Brush ControlText
{
188 if (control_text
== null) {
189 control_text
= new SolidBrush (SystemColors
.ControlText
);
190 control_text
.isModifiable
= false;
197 public static Brush Highlight
{
199 if (highlight
== null) {
200 highlight
= new SolidBrush (SystemColors
.Highlight
);
201 highlight
.isModifiable
= false;
208 public static Brush HighlightText
{
210 if (highlight_text
== null) {
211 highlight_text
= new SolidBrush (SystemColors
.HighlightText
);
212 highlight_text
.isModifiable
= false;
215 return highlight_text
;
219 public static Brush Window
{
221 if (window
== null) {
222 window
= new SolidBrush (SystemColors
.Window
);
223 window
.isModifiable
= false;
229 public static Brush WindowText
{
231 if (window_text
== null) {
232 window_text
= new SolidBrush (SystemColors
.WindowText
);
233 window_text
.isModifiable
= false;
240 public static Brush InactiveBorder
{
242 if (inactive_border
== null) {
243 inactive_border
= new SolidBrush (SystemColors
.InactiveBorder
);
244 inactive_border
.isModifiable
= false;
247 return inactive_border
;
251 public static Brush Desktop
{
253 if (desktop
== null) {
254 desktop
= new SolidBrush (SystemColors
.Desktop
);
255 desktop
.isModifiable
= false;
262 public static Brush HotTrack
{
264 if (hot_track
== null) {
265 hot_track
= new SolidBrush (SystemColors
.HotTrack
);
266 hot_track
.isModifiable
= false;
273 public static Brush InactiveCaption
{
275 if (inactive_caption
== null) {
276 inactive_caption
= new SolidBrush (SystemColors
.InactiveCaption
);
277 inactive_caption
.isModifiable
= false;
280 return inactive_caption
;
284 public static Brush Info
{
287 info
= new SolidBrush (SystemColors
.Info
);
288 info
.isModifiable
= false;
295 public static Brush Menu
{
298 menu
= new SolidBrush (SystemColors
.Menu
);
299 menu
.isModifiable
= false;
306 public static Brush ScrollBar
{
308 if (scroll_bar
== null) {
309 scroll_bar
= new SolidBrush (SystemColors
.ScrollBar
);
310 scroll_bar
.isModifiable
= false;
317 public static Brush
FromSystemColor (Color c
)
319 if (c
.IsSystemColor
) {
320 SolidBrush newBrush
= new SolidBrush (c
);
321 newBrush
.isModifiable
= false;
325 String message
= String
.Format ("The color {0} is not a system color.", c
);
326 throw new ArgumentException (message
);
330 public static Brush ButtonFace
{
332 if (button_face
== null) {
333 button_face
= new SolidBrush (SystemColors
.ButtonFace
);
334 button_face
.isModifiable
= false;
341 public static Brush ButtonHighlight
{
343 if (button_highlight
== null) {
344 button_highlight
= new SolidBrush (SystemColors
.ButtonHighlight
);
345 button_highlight
.isModifiable
= false;
348 return button_highlight
;
352 public static Brush ButtonShadow
{
354 if (button_shadow
== null) {
355 button_shadow
= new SolidBrush (SystemColors
.ButtonShadow
);
356 button_shadow
.isModifiable
= false;
359 return button_shadow
;
363 public static Brush GradientActiveCaption
{
365 if (gradient_activecaption
== null) {
366 gradient_activecaption
= new SolidBrush (SystemColors
.GradientActiveCaption
);
367 gradient_activecaption
.isModifiable
= false;
370 return gradient_activecaption
;
374 public static Brush GradientInactiveCaption
{
376 if (gradient_inactivecaption
== null) {
377 gradient_inactivecaption
= new SolidBrush (SystemColors
.GradientInactiveCaption
);
378 gradient_inactivecaption
.isModifiable
= false;
381 return gradient_inactivecaption
;
385 public static Brush GrayText
{
387 if (graytext
== null) {
388 graytext
= new SolidBrush (SystemColors
.GrayText
);
389 graytext
.isModifiable
= false;
396 public static Brush InactiveCaptionText
{
398 if (inactive_captiontext
== null) {
399 inactive_captiontext
= new SolidBrush (SystemColors
.InactiveCaptionText
);
400 inactive_captiontext
.isModifiable
= false;
403 return inactive_captiontext
;
407 public static Brush InfoText
{
409 if (infotext
== null) {
410 infotext
= new SolidBrush (SystemColors
.InfoText
);
411 infotext
.isModifiable
= false;
418 public static Brush MenuBar
{
420 if (menubar
== null) {
421 menubar
= new SolidBrush (SystemColors
.MenuBar
);
422 menubar
.isModifiable
= false;
429 public static Brush MenuHighlight
{
431 if (menu_highlight
== null) {
432 menu_highlight
= new SolidBrush (SystemColors
.MenuHighlight
);
433 menu_highlight
.isModifiable
= false;
436 return menu_highlight
;
440 public static Brush MenuText
{
442 if (menu_text
== null) {
443 menu_text
= new SolidBrush (SystemColors
.MenuText
);
444 menu_text
.isModifiable
= false;
451 public static Brush WindowFrame
{
453 if (window_fame
== null) {
454 window_fame
= new SolidBrush (SystemColors
.WindowFrame
);
455 window_fame
.isModifiable
= false;