Live Chat Icon For mobile
Live Chat Icon

How do I programmatically set an image as Form’s Icon ?

Platform: WinForms| Category: Form

You could do so as shown in the code below :

[C#]
  Form form1 = new Form();
  Bitmap bmp = imageList1.Images[index] as Bitmap;
  form1.Icon = Icon.FromHandle(bmp.GetHicon());

[VB.NET]
  Dim form1 As Form =  New Form()  
  Dim bmp As Bitmap =  imageList1.Images(index) as Bitmap  
  form1.Icon = Icon.FromHandle(bmp.GetHicon())

Please refer to the sample attached here that illustrates this.

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.