Share via


SystemIcons クラス

定義

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

次のコード例では、 列挙を使用してハンドルからビットマップを Icon 読み込む方法と、 メソッドを使用して GraphicsUnit ビットマップの Round 四角形の境界を描画する方法を示します。

この例は、Windows フォームで使用するように設計されています。 Button2 という名前のボタンを含むフォームをCreateします。 コードをフォームに貼り付け、このメソッドをボタンの 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

既定のアプリケーション アイコン (WIN32: IDI_APPLICATION) を格納している Icon オブジェクトを取得します。

Asterisk

システムのアスタリスク アイコン (WIN32: IDI_ASTERISK) を格納している Icon オブジェクトを取得します。

Error

システムのエラー アイコン (WIN32: IDI_ERROR) を格納している Icon オブジェクトを取得します。

Exclamation

システムの感嘆符アイコン (WIN32: IDI_EXCLAMATION) を格納している Icon オブジェクトを取得します。

Hand

システムの手の形のアイコン (WIN32: IDI_HAND) を格納している Icon オブジェクトを取得します。

Information

システムの情報アイコン (WIN32: IDI_INFORMATION) を格納している Icon オブジェクトを取得します。

Question

システムの疑問符アイコン (WIN32: IDI_QUESTION) を格納している Icon オブジェクトを取得します。

Shield

シールド アイコンを格納している Icon オブジェクトを取得します。

Warning

システムの警告アイコン (WIN32: IDI_WARNING) を格納している Icon オブジェクトを取得します。

WinLogo

Windows のロゴ アイコン (WIN32: IDI_WINLOGO) を格納している Icon オブジェクトを取得します。

メソッド

GetStockIcon(StockIconId, Int32)

指定した Windows シェルストック アイコンを取得します。

GetStockIcon(StockIconId, StockIconOptions)

指定した Windows シェルストック アイコンを取得します。

適用対象