Skip to main content
A newer version of this page is available. .

WinWindow.QueryDefaultFormIcon Event

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

Namespace: DevExpress.ExpressApp.Win

Assembly: DevExpress.ExpressApp.Win.v19.1.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