AppWindow.SetIcon 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
SetIcon(String) |
Sets the icon for the window, using the specified icon path. |
SetIcon(IconId) |
Sets the icon for the window, using the specified icon ID. |
SetIcon(String)
Sets the icon for the window, using the specified icon path.
public:
virtual void SetIcon(Platform::String ^ iconPath) = SetIcon;
/// [Windows.Foundation.Metadata.DefaultOverload]
/// [Windows.Foundation.Metadata.Overload("SetIcon")]
void SetIcon(winrt::hstring const& iconPath);
[Windows.Foundation.Metadata.DefaultOverload]
[Windows.Foundation.Metadata.Overload("SetIcon")]
public void SetIcon(string iconPath);
function setIcon(iconPath)
Public Sub SetIcon (iconPath As String)
Parameters
- iconPath
-
String
Platform::String
winrt::hstring
The path of the icon.
- Attributes
Examples
m_AppWindow.SetIcon("iconPath/iconName.ico");
Remarks
The SetIcon(String) method works only with .ico files. The string you pass to this method is the fully qualified path to the .ico file.
See also
Applies to
SetIcon(IconId)
Sets the icon for the window, using the specified icon ID.
public:
virtual void SetIcon(IconId iconId) = SetIcon;
/// [Windows.Foundation.Metadata.Overload("SetIconWithIconId")]
void SetIcon(IconId const& iconId);
[Windows.Foundation.Metadata.Overload("SetIconWithIconId")]
public void SetIcon(IconId iconId);
function setIcon(iconId)
Public Sub SetIcon (iconId As IconId)
Parameters
- iconId
- IconId
The ID of the icon.
- Attributes
Examples
m_AppWindow.SetIcon(iconId));
Remarks
If you already have a handle to an icon (HICON
) from one of the Icon functions like CreateIcon, you can use the GetIconIdFromIcon interop API to get an IconId. You can then pass the IconId
to the SetIcon(IconId)
method to set your window icon.