Summary description for SysImageList.
Inheritance: IDisposable
Example #1
0
 private Image GetSystemBitmap(SystemImageList sysImgList, int index)
 {
     System.Drawing.Icon ico = sysImgList.Icon(index);
     if (ico != null)
     {
         return(ico.ToBitmap( ));
     }
     else
     {
         return(null);
     }
 }
Example #2
0
        private static void SetImageListControl(Control ctrl, SystemImageList sysImageList, bool forStateImages)
        {
            if (ctrl.GetType( ) != typeof(ListView) && (ctrl.GetType( ) != typeof(TreeView) && !ctrl.GetType( ).IsSubclassOf(typeof(TreeView))))
            {
                throw new ArgumentException("Invalid type of control");
            }

            IntPtr wParam = IntPtr.Zero;

            if (ctrl.GetType( ) == typeof(ListView))
            {
                wParam = (IntPtr)LVSIL_NORMAL;
            }
            else
            {
                wParam = (IntPtr)TVSIL_NORMAL;
            }

            if (sysImageList.ImageListSize == SystemImageListSize.SmallIcons)
            {
                if (ctrl.GetType( ) == typeof(ListView))
                {
                    wParam = (IntPtr)LVSIL_SMALL;
                }
            }
            if (forStateImages)
            {
                if (ctrl.GetType( ) == typeof(ListView))
                {
                    wParam = (IntPtr)LVSIL_STATE;
                }
                else
                {
                    wParam = (IntPtr)TVSIL_STATE;
                }
            }

            if (ctrl.GetType( ) == typeof(ListView))
            {
                SendMessage(ctrl.Handle, LVM_SETIMAGELIST, wParam, sysImageList.Handle);
            }
            else
            {
                SendMessage(ctrl.Handle, TVM_SETIMAGELIST, wParam, sysImageList.Handle);
            }
        }
Example #3
0
 public static void SetImageList(ListView listView, SystemImageList sysImageList, bool forStateImages)
 {
     SystemImageList.SetImageListControl(listView, sysImageList, forStateImages);
 }
Example #4
0
 public static void SetImageList(TreeView tree, SystemImageList sysImageList, bool forStateImages)
 {
     SystemImageList.SetImageListControl(tree, sysImageList, forStateImages);
 }
 private SystemImageListHost()
 {
     SystemIcons = new Dictionary<string, int>();
     SmallSystemImageList = new SystemImageList(SystemImageListSize.SmallIcons);
     LargeSystemImageList = new SystemImageList(SystemImageListSize.LargeIcons);
 }
Example #6
0
 private int GetSystemIconIndex(SystemImageList sysImgList, string file)
 {
     return(sysImgList.IconIndex(file, false));
 }
 private SystemImageListHost()
 {
     SystemIcons          = new Dictionary <string, int>();
     SmallSystemImageList = new SystemImageList(SystemImageListSize.SmallIcons);
     LargeSystemImageList = new SystemImageList(SystemImageListSize.LargeIcons);
 }
Example #8
0
		private static void SetImageListControl ( Control ctrl, SystemImageList sysImageList, bool forStateImages ) {
			if ( ctrl.GetType ( ) != typeof ( ListView ) && ( ctrl.GetType ( ) != typeof ( TreeView ) && !ctrl.GetType ( ).IsSubclassOf ( typeof ( TreeView ) ) ) )
				throw new ArgumentException ( "Invalid type of control" );

			IntPtr wParam = IntPtr.Zero;
			if ( ctrl.GetType ( ) == typeof ( ListView ) )
				wParam = (IntPtr)LVSIL_NORMAL;
			else
				wParam = (IntPtr)TVSIL_NORMAL;

			if ( sysImageList.ImageListSize == SystemImageListSize.SmallIcons ) {
				if ( ctrl.GetType ( ) == typeof ( ListView ) )
					wParam = (IntPtr)LVSIL_SMALL;
			}
			if ( forStateImages ) {
				if ( ctrl.GetType ( ) == typeof ( ListView ) )
					wParam = (IntPtr)LVSIL_STATE;
				else
					wParam = (IntPtr)TVSIL_STATE;
			}

			if ( ctrl.GetType ( ) == typeof ( ListView ) )
				SendMessage ( ctrl.Handle, LVM_SETIMAGELIST, wParam, sysImageList.Handle );
			else
				SendMessage ( ctrl.Handle, TVM_SETIMAGELIST, wParam, sysImageList.Handle );
		}
Example #9
0
		public static void SetImageList ( ListView listView, SystemImageList sysImageList, bool forStateImages ) {
			SystemImageList.SetImageListControl ( listView, sysImageList, forStateImages );
		}
Example #10
0
		public static void SetImageList ( TreeView tree, SystemImageList sysImageList, bool forStateImages ) {
			SystemImageList.SetImageListControl ( tree, sysImageList, forStateImages );
		}
Example #11
0
 /// <summary>
 /// Gets the index of the system icon.
 /// </summary>
 /// <param name="sysImgList">The sys img list.</param>
 /// <param name="file">The file.</param>
 /// <returns></returns>
 private int GetSystemIconIndex( SystemImageList sysImgList, string file )
 {
     return sysImgList.IconIndex ( file, false );
 }
Example #12
0
 /// <summary>
 /// Gets the system bitmap.
 /// </summary>
 /// <param name="sysImgList">The sys img list.</param>
 /// <param name="index">The index.</param>
 /// <returns></returns>
 private Image GetSystemBitmap( SystemImageList sysImgList, int index )
 {
     System.Drawing.Icon ico = sysImgList.Icon ( index );
     if ( ico != null ) {
         return ico.ToBitmap ( );
     } else {
         return null;
     }
 }