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


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.

© 2001-2010 Copyright Syncfusion Inc. All rights reserved.  |  Privacy Policy  |  Contact  |  Sitemap