SystemIcons 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
SystemIcons 类的每个属性都是 Windows 系统级图标的 Icon 对象。 此类不能被继承。
public ref class SystemIcons abstract sealed
	public ref class SystemIcons sealed
	public static class SystemIcons
	public sealed class SystemIcons
	type SystemIcons = class
	Public Class SystemIcons
	Public NotInheritable Class SystemIcons
		- 继承
 - 
				SystemIcons
 
示例
下面的代码示例演示如何使用 GraphicsUnit 枚举从Icon句柄加载位图,并使用 Round 方法绘制位图的矩形边界。
此示例旨在与 Windows 窗体 一起使用。 Create包含名为 Button2 的按钮的窗体。 将代码粘贴到窗体中,并将此方法与按钮的事件 Click 相关联。
void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   Bitmap^ bitmap1 = Bitmap::FromHicon( SystemIcons::Hand->Handle );
   Graphics^ formGraphics = this->CreateGraphics();
   GraphicsUnit units = GraphicsUnit::Point;
   RectangleF bmpRectangleF = bitmap1->GetBounds( units );
   Rectangle bmpRectangle = Rectangle::Round( bmpRectangleF );
   formGraphics->DrawRectangle( Pens::Blue, bmpRectangle );
   delete formGraphics;
}
private void Button2_Click(System.Object sender, System.EventArgs e)
{
    Bitmap bitmap1 = Bitmap.FromHicon(SystemIcons.Hand.Handle);
    Graphics formGraphics = this.CreateGraphics();
    GraphicsUnit units = GraphicsUnit.Point;
    RectangleF bmpRectangleF = bitmap1.GetBounds(ref units);
    Rectangle bmpRectangle = Rectangle.Round(bmpRectangleF);
    formGraphics.DrawRectangle(Pens.Blue, bmpRectangle);
    formGraphics.Dispose();
}
Private Sub Button2_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button2.Click
    Dim bitmap1 As Bitmap = Bitmap.FromHicon(SystemIcons.Hand.Handle)
    Dim formGraphics As Graphics = Me.CreateGraphics()
    Dim units As GraphicsUnit = GraphicsUnit.Point
    Dim bmpRectangleF As RectangleF = bitmap1.GetBounds(units)
    Dim bmpRectangle As Rectangle = Rectangle.Round(bmpRectangleF)
    formGraphics.DrawRectangle(Pens.Blue, bmpRectangle)
    formGraphics.Dispose()
End Sub
	注解
注意
在 .NET 6 及更高版本中, System.Drawing.Common 包(包括此类型)仅在 Windows 操作系统上受支持。 在跨平台应用中使用此类型会导致编译时警告和运行时异常。 有关详细信息,请参阅 仅在 Windows 上支持 System.Drawing.Common。
属性
| Application | 
		 获取 Icon 对象,它包含默认的应用程序图标 (WIN32: IDI_APPLICATION)。  | 
        	
| Asterisk | 
		 获取 Icon 对象,它包含系统星号图标 (WIN32: IDI_ASTERISK)。  | 
        	
| Error | 
		 获取 Icon 对象,它包含系统错误图标 (WIN32: IDI_ERROR)。  | 
        	
| Exclamation | 
		 获取 Icon 对象,它包含系统惊叹号图标 (WIN32: IDI_EXCLAMATION)。  | 
        	
| Hand | 
		 获取 Icon 对象,它包含系统手状图标 (WIN32: IDI_HAND)。  | 
        	
| Information | 
		 获取 Icon 对象,它包含系统信息图标 (WIN32: IDI_INFORMATION)。  | 
        	
| Question | 
		 获取 Icon 对象,它包含系统问号图标 (WIN32: IDI_QUESTION)。  | 
        	
| Shield | 
		 获取包含盾牌图标的 Icon 对象。  | 
        	
| Warning | 
		 获取 Icon 对象,它包含系统警告图标 (WIN32: IDI_WARNING)。  | 
        	
| WinLogo | 
		 获取 Icon 对象,它包含 Windows 徽标图标 (WIN32: IDI_WINLOGO)。  | 
        	
方法
| GetStockIcon(StockIconId, Int32) | 
		 获取指定的 Windows shell 库存图标。  | 
        	
| GetStockIcon(StockIconId, StockIconOptions) | 
		 获取指定的 Windows shell 库存图标。  |