private void LoadPicture(System.Windows.Forms.UnsafeNativeMethods.IStream stream)
 {
     if (stream == null)
     {
         throw new ArgumentNullException("stream");
     }
     try
     {
         Guid gUID = typeof(System.Windows.Forms.UnsafeNativeMethods.IPicture).GUID;
         System.Windows.Forms.UnsafeNativeMethods.IPicture o = null;
         new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert();
         try
         {
             o = System.Windows.Forms.UnsafeNativeMethods.OleCreateIPictureIndirect(null, ref gUID, true);
             ((System.Windows.Forms.UnsafeNativeMethods.IPersistStream)o).Load(stream);
             if ((o == null) || (o.GetPictureType() != 3))
             {
                 throw new ArgumentException(System.Windows.Forms.SR.GetString("InvalidPictureType", new object[] { "picture", "Cursor" }), "picture");
             }
             IntPtr handle = o.GetHandle();
             System.Drawing.Size iconSize = this.GetIconSize(handle);
             this.handle    = System.Windows.Forms.SafeNativeMethods.CopyImageAsCursor(new HandleRef(this, handle), 2, iconSize.Width, iconSize.Height, 0);
             this.ownHandle = true;
         }
         finally
         {
             CodeAccessPermission.RevertAssert();
             if (o != null)
             {
                 Marshal.ReleaseComObject(o);
             }
         }
     }
     catch (COMException exception)
     {
         throw new ArgumentException(System.Windows.Forms.SR.GetString("InvalidPictureFormat"), "stream", exception);
     }
 }
 public static extern int ImageList_WriteEx(HandleRef himl, int dwFlags, System.Windows.Forms.UnsafeNativeMethods.IStream pstm);
 public static extern bool ImageList_Write(HandleRef himl, System.Windows.Forms.UnsafeNativeMethods.IStream pstm);
 public static extern IntPtr ImageList_Read(System.Windows.Forms.UnsafeNativeMethods.IStream pstm);