예제 #1
0
 /// <summary>
 /// Gets the Bitmap of this ShellItem's Icon
 /// </summary>
 /// <param name="Size"></param>
 /// <param name="format"></param>
 /// <param name="retrieve"></param>
 /// <returns></returns>
 internal Bitmap GetShellThumbnail(int Size, ShellThumbnailFormatOption format = ShellThumbnailFormatOption.Default, ShellThumbnailRetrievalOption retrieve = ShellThumbnailRetrievalOption.Default)
 {
     this.Thumbnail.RetrievalOption = retrieve;
     this.Thumbnail.FormatOption    = format;
     this.Thumbnail.CurrentSize     = new System.Windows.Size(Size, Size);
     return(this.Thumbnail.Bitmap);
 }
예제 #2
0
        public System.Windows.Media.Imaging.BitmapSource ThumbnailSource(int size, ShellThumbnailFormatOption format, ShellThumbnailRetrievalOption source)
        {
            //if (this.IsSearchFolder)
            //	this._Item.ComInterface = this.searchFolder.m_SearchComInterface;

            this._Item.Thumbnail.CurrentSize     = new System.Windows.Size(size, size);
            this._Item.Thumbnail.RetrievalOption = source;
            this._Item.Thumbnail.FormatOption    = format;
            return(this._Item.Thumbnail.BitmapSource);
        }
예제 #3
0
        public BitmapSource ThumbnailSource(int size, ShellThumbnailFormatOption format, ShellThumbnailRetrievalOption source)
        {
            var hBitmap = this.GetHBitmap(size, format == ShellThumbnailFormatOption.ThumbnailOnly, source == ShellThumbnailRetrievalOption.Default, format == ShellThumbnailFormatOption.Default);

            // return a System.Media.Imaging.BitmapSource
            // Use interop to create a BitmapSource from hBitmap.
            if (hBitmap == IntPtr.Zero)
            {
                return(null);
            }

            var returnValue = Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()).Clone();

            // delete HBitmap to avoid memory leaks
            Gdi32.DeleteObject(hBitmap);
            return(returnValue);
        }
예제 #4
0
 public System.Drawing.Bitmap Thumbnail(int size, ShellThumbnailFormatOption format, ShellThumbnailRetrievalOption source) => this._Item?.GetShellThumbnail(size, format, source);
예제 #5
0
    public BitmapSource ThumbnailSource(int size, ShellThumbnailFormatOption format, ShellThumbnailRetrievalOption source) {
      //if (this.IsSearchFolder)
      //	this._Item.ComInterface = this.searchFolder.m_SearchComInterface;

      this._Item.Thumbnail.CurrentSize = new System.Windows.Size(size, size);
      this._Item.Thumbnail.RetrievalOption = source;
      this._Item.Thumbnail.FormatOption = format;
      return this._Item.Thumbnail.BitmapSource;
    }
예제 #6
0
 public System.Drawing.Bitmap Thumbnail(int size, ShellThumbnailFormatOption format, ShellThumbnailRetrievalOption source) =>
     this._Item.GetShellThumbnail(size, format, source);