SetBitmapListValue example for VB.NET

'LEADDICOM1 is a DICOM Dataset defined outside this method
'This example uses the predefined variable "LEADRasterView1" of type "AxLEADRasterView" from "LEADTOOLS Toolkit".
'This example uses the predefined variable "LEADRasterView2" of type "AxLEADRasterView" from "LEADTOOLS Toolkit".
Private Sub TestSetBitmapListValue ()
   Dim lCount As Integer
   Dim nRet As Short
   Dim IO As New LTRASTERIOLib.LEADRasterIO
   Dim Process As New LTRASTERPROCLib.LEADRasterProcess
   LEADDICOM1.EnableMethodErrors = False
   'move to the root element
   LEADDICOM1.MoveFirstElement(False) LEADDICOM1.MoveRootElement()
   'insert a new element for the BitmapList Value
   nRet = LEADDICOM1.FindFirstElement(LTDICLib.DicomDataSetTagConstants9.TAG_PIXEL_DATA, False)
   nRet = LEADDICOM1.DeleteElement()
   nRet = LEADDICOM1.InsertElement(False, LTDICLib.DicomDataSetTagConstants9.TAG_PIXEL_DATA, LTDICLib.DicomVRCodeConstants.VR_OB, False, 0)
   'load an image
   IO.Load(LEADRasterView1.Raster, "d:\lead14\dist\images\image1.cmp", 0, 1, 1)
   MessageBox.Show("Image loaded from File - Wait")
   'create a bitmap list
   LEADRasterView2.Raster.InsertBitmapListItem(0, LEADRasterView1.Raster.Bitmap)
   Process.Flip(LEADRasterView1.Raster)
   LEADRasterView2.Raster.InsertBitmapListItem(1, LEADRasterView1.Raster.Bitmap)
   Process.Reverse(LEADRasterView1.Raster)
   LEADRasterView2.Raster.InsertBitmapListItem(2, LEADRasterView1.Raster.Bitmap)
   'insert the image list into the element
   LEADDICOM1.BitmapList = LEADRasterView2.Raster.BitmapList
   'set the bitmap list
   nRet = LEADDICOM1.SetBitmapListValue(LTDICLib.DicomImageCompressionConstants.DICOM_IMAGE_COMPRESSION_NONE, LTDICLib.DicomImagePhotometricConstants.DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0, 0)
   If (nRet <> 0) Then
      MessageBox.Show("Error")
      Exit Sub
   End If
   MessageBox.Show("Image set to Data Set - Wait")
   LEADDICOM1.BitmapList = 0
   'free the value
   MessageBox.Show("ImageList cleared from memory - Wait")
   lCount = LEADDICOM1.GetBitmapCount
   'get the bitmap list back
   If (nRet = 0) Then
      LEADDICOM1.GetBitmapListValue(0, lCount, 0, LTDICLib.DicomColorOrderConstants.ORDER_RGB, 0)
      LEADRasterView1.Raster.BitmapList = LEADDICOM1.BitmapList
      LEADRasterView1.ForceRepaint()
   End If
   LEADDICOM1.EnableMethodErrors = True
   MessageBox.Show("ImageList loaded from Data Set - Wait")
End Sub