Skip to main content
.NET Framework 4.6.2+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

WinWindow.QueryDefaultFormIcon Event

Occurs before assigning default icons to the WinWindow‘s Template.

Namespace: DevExpress.ExpressApp.Win

Assembly: DevExpress.ExpressApp.Win.v24.2.dll

#Declaration

public static event EventHandler<QueryIconEventArgs> QueryDefaultFormIcon

#Event Data

The QueryDefaultFormIcon event's data class is QueryIconEventArgs. The following properties provide information specific to this event:

Property Description
IconLarge Specifies the default large icon to be used by a Window‘s Template.
IconSmall Specifies the default small icon to be used by a Window‘s Template.

#Remarks

By default, the QueryIconEventArgs.IconLarge and QueryIconEventArgs.IconSmall properties contain default icons extracted from the application’s executable file. However, you can handle this event to specify custom default icons that should be used by Windows in a Windows Forms application. You can handle this event, for instance, in the Main method of your Program class.

Program.cs (Program.vb)

using System.Drawing;
//...
public class Program {
    static Icon smallIcon;
    static Icon largeIcon;
    //...
    public static void Main(string[] arguments) {
        //...
        WinWindow.QueryDefaultFormIcon += WinWindow_QueryDefaultFormIcon;
        winApplication.Setup();
        winApplication.Start();
    }
    static void WinWindow_QueryDefaultFormIcon(object sender, QueryIconEventArgs e) {
        if (smallIcon == null)
            smallIcon = Icon.ExtractAssociatedIcon("C:\\MyIcon.ico");
        if(largeIcon == null)
            largeIcon = Icon.ExtractAssociatedIcon("C:\\MyIcon2.ico");
        e.IconLarge = largeIcon;
        e.IconSmall = smallIcon;
    }
}
See Also