2007/03/28

HOWTO Getting 16x16 icons for file types

1. Download this sample.

2. Put a button and a textbox on the form.

3. Use a snippet similar to:
Dim types As String() = txtFileTypes.Text.Split(",")
For i As Integer = 0 To types.GetLength(0) - 1
  Dim im As Image = _
  Me.FileSystemImages.SmallImageList.Images( _
  FileSystemImages.GetTheFileIconIndex("*." & types(i)))
  im.Save(Application.StartupPath & "\" & types(i) & ".bmp", _
  Imaging.ImageFormat.Bmp)
Next
and you have a tool that allows you to retrieve 16x16 icons for different file types.

1 comment: