BlockTableRecord PreviewIcon

#1
When using blocktablerecord to generate previewicon block is set to nothing.

Code: Select all

 
 Try
            Dim doc As Document = IntelliCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument

            Using tr As Transaction = doc.TransactionManager.StartTransaction
                Dim btr As BlockTableRecord = tr.GetObject(Util.BlockTableRecordId(lstBox.SelectedItem), OpenMode.ForRead)

                Dim bmp As Bitmap = btr.PreviewIcon
                Dim i As Image = TryCast(bmp, Image)


                Dim SaveStream As New System.IO.MemoryStream
                'Save the bitmap/image to the memory stream in the desired format
                bmp.Save(SaveStream, Imaging.ImageFormat.Bmp)
                'Extract the file bytes from the memory stream

                picBox.Image = Image.FromStream(SaveStream)

                tr.Abort()
            End Using
        Catch ex As System.Exception
            MsgBox(ex.Message)
        End Try
        
cron