How to set Icons for Window Forms

| August 14, 2010 | 0 Comments

To show icon in the Windows Form’s header you can use Windows Form property Icon from Design view. But if you want to set it programatically have look on code.

Icon in window form

Code Snippet

private void Form1_Load(object sender, EventArgs e)
        {
            //1// Set icon from icon file as
            Icon ico = new Icon(@"D:\Zodes\g.ico");
            this.Icon = ico;

            //2// Set image as icon
            Bitmap bmp=new Bitmap(@"D:\Zodes\s.jpg");
            this.Icon = Icon.FromHandle(bmp.GetHicon());

        }

Category: .NET, Tips

Leave a Reply

%d bloggers like this: