private static string ExtractThumbnails(string iconPath, Transaction tr, ObjectId id)
        {
            var btr = (BlockTableRecord)tr.GetObject(id, OpenMode.ForRead);

            if (!Directory.Exists(iconPath))
            {
                Directory.CreateDirectory(iconPath);
            }

            // Save the icon to our out directory

            var imgsrc = CMLContentSearchPreviews.GetBlockTRThumbnail(btr);
            var bmp    = ImageSourceToGDI(imgsrc as System.Windows.Media.Imaging.BitmapSource);

            var fname = $"{iconPath}\\{btr.Name}.bmp";

            if (File.Exists(fname))
            {
                File.Delete(fname);
            }

            bmp.Save(fname);

            return(fname);
        }
Beispiel #2
0
        public static Icon GetPreviewIcon(BlockTableRecord btr)
        {
            var imgsrc  = CMLContentSearchPreviews.GetBlockTRThumbnail(btr);
            var bitmap  = (Bitmap)ImageSourceToGDI((BitmapSource)imgsrc);
            var iconPtr = bitmap.GetHicon();

            return(Icon.FromHandle(iconPtr));
        }
Beispiel #3
0
        public static System.Drawing.Image GetPreviewImage(BlockTableRecord btr)
        {
            var imgsrc = CMLContentSearchPreviews.GetBlockTRThumbnail(btr);

            return(ImageSourceToGDI((BitmapSource)imgsrc));
        }
Beispiel #4
0
 public static ImageSource GetPreview(BlockTableRecord btr)
 {
     return(CMLContentSearchPreviews.GetBlockTRThumbnail(btr));
 }