DroidExplorer.Core.UI.SystemImageList.SetImageListControl C# (CSharp) Метод

SetImageListControl() приватный статический Метод

private static SetImageListControl ( Control ctrl, SystemImageList sysImageList, bool forStateImages ) : void
ctrl Control
sysImageList SystemImageList
forStateImages bool
Результат void
		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 );
		}
		#endregion

Usage Example

Пример #1
0
 public static void SetImageList(ListView listView, SystemImageList sysImageList, bool forStateImages)
 {
     SystemImageList.SetImageListControl(listView, sysImageList, forStateImages);
 }
All Usage Examples Of DroidExplorer.Core.UI.SystemImageList::SetImageListControl