public static void SetTreeViewImageList( TreeView treeView, ShellImageList shellImageList, bool forStateImages)
 {
     if (treeView == null) throw new ArgumentNullException("treeView");
     if (shellImageList == null) throw new ArgumentNullException("shellImageList");
     var wParam = (IntPtr) TVSIL_NORMAL;
     if( forStateImages )
     {
         wParam = (IntPtr) TVSIL_STATE;
     }
     NativeMethods.SendMessage(
         treeView.Handle,
         TVM_SETIMAGELIST,
         wParam,
         shellImageList.Handle);
 }
 public static void SetListViewImageList(
     ListView listView,
     ShellImageList shellImageList,
     bool forStateImages
     )
 {
     if (listView == null) throw new ArgumentNullException("listView");
     if (shellImageList == null) throw new ArgumentNullException("shellImageList");
     var wParam = (IntPtr) LVSIL_NORMAL;
     if( shellImageList.ImageListSize == ShellImageListSize.SmallIcons )
     {
         wParam = (IntPtr) LVSIL_SMALL;
     }
     if( forStateImages )
     {
         wParam = (IntPtr) LVSIL_STATE;
     }
     NativeMethods.SendMessage(
         listView.Handle,
         LVM_SETIMAGELIST,
         wParam,
         shellImageList.Handle);
 }