SystemIcons 类

定义

SystemIcons 类的每个属性都是 Windows 系统级图标的 Icon 对象。Each property of the SystemIcons class is an Icon object for Windows system-wide icons. 此类不能被继承。This class cannot be inherited.

public ref class SystemIcons sealed
public sealed class SystemIcons
type SystemIcons = class
Public NotInheritable Class SystemIcons
继承
SystemIcons

示例

下面的代码示例演示如何Icon GraphicsUnit使用枚举从句柄加载位图, Round并使用方法来绘制位图的矩形边界。The following code example demonstrates how to load a bitmap from an Icon handle, using the GraphicsUnit enumeration, and the use of the Round method to draw the rectangle bounds of a bitmap.

此示例旨在与 Windows 窗体一起使用。This example is designed to be used with Windows Forms. 创建一个包含名为 "Button2" 的按钮的窗体。Create a form that contains a button named Button2. 将代码粘贴到窗体中, 并将此方法与按钮Click的事件关联。Paste the code into the form and associate this method with the button's Click event.

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

属性

Application

获取 Icon 对象,它包含默认的应用程序图标 (WIN32:IDI_APPLICATION)。Gets an Icon object that contains the default application icon (WIN32: IDI_APPLICATION).

Asterisk

获取 Icon 对象,它包含系统星号图标 (WIN32:IDI_ASTERISK)。Gets an Icon object that contains the system asterisk icon (WIN32: IDI_ASTERISK).

Error

获取 Icon 对象,它包含系统错误图标 (WIN32:IDI_ERROR)。Gets an Icon object that contains the system error icon (WIN32: IDI_ERROR).

Exclamation

获取 Icon 对象,它包含系统惊叹号图标 (WIN32:IDI_EXCLAMATION)。Gets an Icon object that contains the system exclamation icon (WIN32: IDI_EXCLAMATION).

Hand

获取 Icon 对象,它包含系统手状图标 (WIN32:IDI_HAND)。Gets an Icon object that contains the system hand icon (WIN32: IDI_HAND).

Information

获取 Icon 对象,它包含系统信息图标 (WIN32:IDI_INFORMATION)。Gets an Icon object that contains the system information icon (WIN32: IDI_INFORMATION).

Question

获取 Icon 对象,它包含系统问号图标 (WIN32:IDI_QUESTION)。Gets an Icon object that contains the system question icon (WIN32: IDI_QUESTION).

Shield

获取包含盾牌图标的 Icon 对象。Gets an Icon object that contains the shield icon.

Warning

获取 Icon 对象,它包含系统警告图标 (WIN32:IDI_WARNING)。Gets an Icon object that contains the system warning icon (WIN32: IDI_WARNING).

WinLogo

获取 Icon 对象,它包含 Windows 徽标图标 (WIN32:IDI_WINLOGO)。Gets an Icon object that contains the Windows logo icon (WIN32: IDI_WINLOGO).

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于