2 // System.Drawing.SystemBrushes.cs
5 // Dennis Hayes (dennish@Raytek.com)
6 // Ravindra (rkumar@novell.com)
8 // Copyright (C) 2002 Ximian, Inc. http://www.ximian.com
9 // Copyright (C) 2004 Novell, Inc. http://www.novell.com
13 // Copyright (C) 2004 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
40 /// Summary description for SystemBrushes.
42 public sealed class SystemBrushes
44 static SolidBrush active_border;
45 static SolidBrush active_caption;
46 static SolidBrush active_caption_text;
47 static SolidBrush app_workspace;
48 static SolidBrush control;
49 static SolidBrush control_dark;
50 static SolidBrush control_dark_dark;
51 static SolidBrush control_light;
52 static SolidBrush control_light_light;
53 static SolidBrush control_text;
54 static SolidBrush desktop;
55 static SolidBrush highlight;
56 static SolidBrush highlight_text;
57 static SolidBrush hot_track;
58 static SolidBrush inactive_border;
59 static SolidBrush inactive_caption;
60 static SolidBrush info;
61 static SolidBrush menu;
62 static SolidBrush scroll_bar;
63 static SolidBrush window;
64 static SolidBrush window_text;
66 private SystemBrushes() { }
68 public static Brush ActiveBorder
71 if (active_border == null) {
72 active_border = new SolidBrush (SystemColors.ActiveBorder);
73 active_border.isModifiable = false;
80 public static Brush ActiveCaption
83 if (active_caption == null) {
84 active_caption = new SolidBrush (SystemColors.ActiveCaption);
85 active_caption.isModifiable = false;
88 return active_caption;
92 public static Brush ActiveCaptionText
95 if (active_caption_text == null) {
96 active_caption_text = new SolidBrush (SystemColors.ActiveCaptionText);
97 active_caption_text.isModifiable = false;
100 return active_caption_text;
104 public static Brush AppWorkspace
107 if (app_workspace == null) {
108 app_workspace = new SolidBrush (SystemColors.AppWorkspace);
109 app_workspace.isModifiable = false;
112 return app_workspace;
116 public static Brush Control {
118 if (control == null) {
119 control = new SolidBrush (SystemColors.Control);
120 control.isModifiable = false;
127 public static Brush ControlLight {
129 if (control_light == null) {
130 control_light = new SolidBrush (SystemColors.ControlLight);
131 control_light.isModifiable = false;
134 return control_light;
138 public static Brush ControlLightLight {
140 if (control_light_light == null) {
141 control_light_light = new SolidBrush (SystemColors.ControlLightLight);
142 control_light_light.isModifiable = false;
145 return control_light_light;
149 public static Brush ControlDark {
151 if (control_dark == null) {
152 control_dark = new SolidBrush (SystemColors.ControlDark);
153 control_dark.isModifiable = false;
160 public static Brush ControlDarkDark {
162 if (control_dark_dark == null) {
163 control_dark_dark = new SolidBrush (SystemColors.ControlDarkDark);
164 control_dark_dark.isModifiable = false;
167 return control_dark_dark;
171 public static Brush ControlText {
173 if (control_text == null) {
174 control_text = new SolidBrush (SystemColors.ControlText);
175 control_text.isModifiable = false;
182 public static Brush Highlight {
184 if (highlight == null) {
185 highlight = new SolidBrush (SystemColors.Highlight);
186 highlight.isModifiable = false;
193 public static Brush HighlightText {
195 if (highlight_text == null) {
196 highlight_text = new SolidBrush (SystemColors.HighlightText);
197 highlight_text.isModifiable = false;
200 return highlight_text;
204 public static Brush Window {
206 if (window == null) {
207 window = new SolidBrush (SystemColors.Window);
208 window.isModifiable = false;
214 public static Brush WindowText {
216 if (window_text == null) {
217 window_text = new SolidBrush (SystemColors.WindowText);
218 window_text.isModifiable = false;
225 public static Brush InactiveBorder {
227 if (inactive_border == null) {
228 inactive_border = new SolidBrush (SystemColors.InactiveBorder);
229 inactive_border.isModifiable = false;
232 return inactive_border;
236 public static Brush Desktop {
238 if (desktop == null) {
239 desktop = new SolidBrush (SystemColors.Desktop);
240 desktop.isModifiable = false;
247 public static Brush HotTrack {
249 if (hot_track == null) {
250 hot_track = new SolidBrush (SystemColors.HotTrack);
251 hot_track.isModifiable = false;
258 public static Brush InactiveCaption {
260 if (inactive_caption == null) {
261 inactive_caption = new SolidBrush (SystemColors.InactiveCaption);
262 inactive_caption.isModifiable = false;
265 return inactive_caption;
269 public static Brush Info {
272 info = new SolidBrush (SystemColors.Info);
273 info.isModifiable = false;
280 public static Brush Menu {
283 menu = new SolidBrush (SystemColors.Menu);
284 menu.isModifiable = false;
291 public static Brush ScrollBar {
293 if (scroll_bar == null) {
294 scroll_bar = new SolidBrush (SystemColors.ScrollBar);
295 scroll_bar.isModifiable = false;
302 public static Brush FromSystemColor (Color c)
304 if (c.IsSystemColor) {
305 SolidBrush newBrush = new SolidBrush (c);
306 newBrush.isModifiable = false;
310 String message = String.Format ("The color {0} is not a system color.", c);
311 throw new ArgumentException (message);