public void DrawImage(IntPtr hdc,int index,int x,int y,ImageListDrawItemOptions imageListDrawItemOptions,int width,int height,
     Color foreColor,ImageListDrawStateOptions stateOptions,Color saturateColorOrAlpha,Color glowOrShadowColor)
 {
     var pimldp = new IMAGELISTDRAWPARAMS();
     pimldp.hdcDst = hdc;
     pimldp.cbSize = Marshal.SizeOf(pimldp.GetType());
     pimldp.i = index;
     pimldp.x = x;
     pimldp.y = y;
     pimldp.cx = width;
     pimldp.cy = height;
     pimldp.rgbFg = Color.FromArgb(0,
                                   foreColor.R, foreColor.G, foreColor.B).ToArgb();
     Console.WriteLine("{0}", pimldp.rgbFg);
     pimldp.fStyle = (int) imageListDrawItemOptions;
     pimldp.fState = (int) stateOptions;
     if ((stateOptions & ImageListDrawStateOptions.Alpha) ==
         ImageListDrawStateOptions.Alpha)
     {
         // Set the alpha:
         pimldp.Frame = saturateColorOrAlpha.A;
     }
     else if ((stateOptions & ImageListDrawStateOptions.Saturate) ==
              ImageListDrawStateOptions.Saturate)
     {
         // discard alpha channel:
         saturateColorOrAlpha = Color.FromArgb(0,
                                               saturateColorOrAlpha.R,
                                               saturateColorOrAlpha.G,
                                               saturateColorOrAlpha.B);
         // set the saturate color
         pimldp.Frame = saturateColorOrAlpha.ToArgb();
     }
     glowOrShadowColor = Color.FromArgb(0,
                                        glowOrShadowColor.R,
                                        glowOrShadowColor.G,
                                        glowOrShadowColor.B);
     pimldp.crEffect = glowOrShadowColor.ToArgb();
     if (iImageList == null)
     {
         pimldp.himl = hIml;
         int ret = NativeMethods.ImageList_DrawIndirect(ref pimldp);
         if (ret != 0) throw new ShellImageListException("Error drawing image. Return code: {0}, Last Win32 Error: {1}", ret, Marshal.GetLastWin32Error());
     }
     else
     {
         var result = iImageList.Draw(ref pimldp);
         if (result != 0) throw new ShellImageListException("Error drawing image. Result={0}", result);
     }
 }
 public void DrawImage(
     IntPtr hdc,
     int index,
     int x,
     int y,
     ImageListDrawItemOptions imageListDrawItemOptions,
     int width,
     int height
     )
 {
     var pimldp = new IMAGELISTDRAWPARAMS();
     pimldp.hdcDst = hdc;
     pimldp.cbSize = Marshal.SizeOf(pimldp.GetType());
     pimldp.i = index;
     pimldp.x = x;
     pimldp.y = y;
     pimldp.cx = width;
     pimldp.cy = height;
     pimldp.fStyle = (int) imageListDrawItemOptions;
     if (iImageList == null)
     {
         pimldp.himl = hIml;
         int ret = NativeMethods.ImageList_DrawIndirect(ref pimldp);
         if (ret != 0) throw new ShellImageListException("Error drawing image. Return code: {0}, Last Win32 Error: {1}", ret, Marshal.GetLastWin32Error());
     }
     else
     {
         var result = iImageList.Draw(ref pimldp);
         if (result != 0) throw new ShellImageListException("Error drawing image. Return code: {0}", result);
     }
 }