2 // System.Drawing.systemIcons.cs
5 // Vladimir Krasnov (vladimirk@mainsoft.com)
6 // Konstantin Triger (kostat@mainsoft.com)
8 // Copyright (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 using System
.Configuration
;
35 using System
.Collections
;
36 using System
.Collections
.Specialized
;
37 using System
.Reflection
;
39 namespace System
.Drawing
{
40 public sealed class SystemIcons
{
41 static readonly Icon
[] systemIcons
;
44 Application
, Asterisk
, Error
,
45 Exclamation
, Hand
, Information
,
46 Question
, Warning
, WinLogo
49 static SystemIcons() {
51 Type nameType
= typeof(IconName
);
52 string [] iconNames
= Enum
.GetNames(nameType
);
53 systemIcons
= new Icon
[iconNames
.Length
];
54 Assembly assembly
= Assembly
.GetExecutingAssembly();
55 for (int i
= 0; i
< iconNames
.Length
; i
++)
56 systemIcons
[(int)(IconName
)Enum
.Parse(nameType
, iconNames
[i
])] =
57 new Icon(assembly
.GetManifestResourceStream(String
.Format("System.Drawing.Assembly.{0}.ico", iconNames
[i
])));
60 private SystemIcons() {
63 public static Icon Application { get { return systemIcons[(int)IconName.Application];}
}
64 public static Icon Asterisk { get { return systemIcons[(int)IconName.Asterisk];}
}
65 public static Icon Error { get { return systemIcons[(int)IconName.Error];}
}
66 public static Icon Exclamation { get { return systemIcons[(int)IconName.Exclamation];}
}
67 public static Icon Hand { get { return systemIcons[(int)IconName.Hand];}
}
68 public static Icon Information { get { return systemIcons[(int)IconName.Information];}
}
69 public static Icon Question { get { return systemIcons[(int)IconName.Question];}
}
70 public static Icon Warning { get { return systemIcons[(int)IconName.Warning];}
}
71 public static Icon WinLogo { get { return systemIcons[(int)IconName.WinLogo];}
}