/// <summary> /// SysImageListをツリービューにに関連付ける /// </summary> /// <param name="treeView">TreeView control to associated ImageList with</param> /// <param name="sysImageList">System Image List to associate</param> /// <param name="forStateImages">Whether to add ImageList as StateImageList</param> public static void SetTreeViewImageList( TreeView treeView, SystemImageList sysImageList, bool forStateImages ) { IntPtr wParam = (IntPtr)TVSIL_NORMAL; if( forStateImages ) { wParam = (IntPtr)TVSIL_STATE; } Api.SendMessage( treeView.Handle, TVM_SETIMAGELIST, wParam, sysImageList.Handle ); }
/// <summary> /// SysImageListをリストビューにに関連付ける /// </summary> /// <param name="listView">ListView control to associate ImageList with</param> /// <param name="sysImageList">System Image List to associate</param> /// <param name="forStateImages">Whether to add ImageList as StateImageList</param> public static void SetListViewImageList( ListView listView, SystemImageList sysImageList, bool forStateImages ) { IntPtr wParam = (IntPtr)LVSIL_NORMAL; if( sysImageList.ImageListSize == SystemImageListSize.SmallIcons ) { wParam = (IntPtr)LVSIL_SMALL; } if( forStateImages ) { wParam = (IntPtr)LVSIL_STATE; } Api.SendMessage( listView.Handle, LVM_SETIMAGELIST, wParam, sysImageList.Handle ); }