Ecco una funzioncina nata da una domanda sul Newsgroup di Vb.Net per generare un file ico da uno bmp.
Public Sub BmpToIcon(ByVal fileName As String) Dim bitmap As System.Drawing.Bitmap = _ New System.Drawing.Bitmap(fileName) Dim hIcon As IntPtr = bitmap.GetHicon()
Dim icon As System.Drawing.Icon = _ System.Drawing.Icon.FromHandle(hIcon)
Dim stream As IO.Stream = IO.File.OpenWrite( _ System.IO.Path.GetDirectoryName(fileName) & _ System.IO.Path.GetFileNameWithoutExtension(fileName) & ".ico")
icon.Save(stream)
stream.Close()
icon.Dispose() bitmap.Dispose()End Sub