Leggi in inglese Modifica

Condividi tramite


SystemIcons.GetStockIcon Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

GetStockIcon(StockIconId, StockIconOptions)

Gets the specified Windows shell stock icon.

GetStockIcon(StockIconId, Int32)

Gets the specified Windows shell stock icon.

GetStockIcon(StockIconId, StockIconOptions)

Source:
SystemIcons.cs
Source:
SystemIcons.cs
Source:
SystemIcons.cs
Source:
SystemIcons.cs

Gets the specified Windows shell stock icon.

C#
public static System.Drawing.Icon GetStockIcon(System.Drawing.StockIconId stockIcon, System.Drawing.StockIconOptions options = System.Drawing.StockIconOptions.Default);

Parameters

stockIcon
StockIconId

The stock icon to retrieve.

options
StockIconOptions

A bitwise combination of the enumeration values that specifies options for retrieving the icon.

Returns

The requested Icon.

Exceptions

stockIcon is an invalid StockIconId.

Remarks

Unlike the static icon properties in SystemIcons, this API returns icons that are themed for the running version of Windows. Additionally, the returned Icon is not cached and should be disposed when no longer needed.

Applies to

.NET 10 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
Windows Desktop 8, 9, 10

GetStockIcon(StockIconId, Int32)

Source:
SystemIcons.cs
Source:
SystemIcons.cs
Source:
SystemIcons.cs
Source:
SystemIcons.cs

Gets the specified Windows shell stock icon.

C#
public static System.Drawing.Icon GetStockIcon(System.Drawing.StockIconId stockIcon, int size);

Parameters

stockIcon
StockIconId

The stock icon to retrieve.

size
Int32

The desired size. If the specified size does not exist, an existing size will be resampled to give the requested size.

Returns

The requested Icon.

Applies to

.NET 10 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
Windows Desktop 8, 9, 10