ContainerCellProperties Example for Visual C++ 5.0

void ContainerCellProperties(CLEADRasterContainerViewer * pLEADContainerViewer) 
{
   TRY
   {
      char * MedicalKey = "";

      pLEADContainerViewer->SetEnableMethodErrors (TRUE); 
   
      ILEADRaster* pRaster = NULL; 
      CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRaster); 
      
      pRaster->UnlockSupport (L_SUPPORT_MEDICAL, TEXT(MedicalKey)); 
      
      ILEADRasterIO* pRasterIO= NULL; 
      CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO); 

      //Load IMAGE3.dic from LEAD Technologies setup directory
      pRasterIO->Load (pRaster, "C:\\LEAD Technologies, Inc\\LEADTOOLS14\\Images\\IMAGE3.dic", 0, 0, -1); 


      // Insert a new cell at the end of the container cell queue. 
      long iCellIndex = pLEADContainerViewer->InsertCell (-1, 0); 
   
      // Attach the loaded raster to the newly inserted cell. 
      pLEADContainerViewer->Cell (iCellIndex).InsertBitmapList (pRaster, TRUE, 0); 
   
      
      ILEADContainerViewerProperties * pContainerViewerProps = NULL; 
      HRESULT hr = CoCreateInstance( CLSID_LEADContainerViewerProperties, NULL, CLSCTX_ALL, 
                                     IID_ILEADContainerViewerProperties,(void**)&pContainerViewerProps ); 

      //Set Container properties
      pLEADContainerViewer->GetContainerProperties (pContainerViewerProps, 0); 

      pContainerViewerProps->PutIncludedParameters (CONVIEW_CIP_ALL); 
      // Change the number of rows and cols to show all the inserted cells. 
  pContainerViewerProps->PutRowCount (4); 
  pContainerViewerProps->PutColumnCount (8); 
  pContainerViewerProps->PutEmptyCellBackGroundColor (RGB(0,0,0)); 
  pContainerViewerProps->PutBackGroundColor (RGB(0,0, 255)); 
  pContainerViewerProps->PutTextColor (RGB(0,255,0)); 
  pContainerViewerProps->PutShadowColor (RGB(255,255,255)); 
  pContainerViewerProps->PutRulerInColor (RGB(0,255,255)); 
  pContainerViewerProps->PutRulerOutColor (RGB(255,0,255)); 
  pContainerViewerProps->PutActiveCellBorderColor (RGB(0,255, 0)); 
  pContainerViewerProps->PutNonActiveCellBorderColor (RGB(255,255,255)); 
  pContainerViewerProps->PutActiveSubCellBorderColor (RGB(255,255,0)); 

      CPictureHolder PicHolder; 
      
      PicHolder.CreateFromIcon(LoadCursor(NULL, IDC_ARROW)); 
  pContainerViewerProps->PutDefaultCursor (PicHolder.GetPictureDispatch());
      
      PicHolder.CreateFromIcon(LoadCursor(NULL, IDC_WAIT)); 
  pContainerViewerProps->PutVerticalResizeCursor (PicHolder.GetPictureDispatch());
      PicHolder.CreateFromIcon(LoadCursor(NULL, IDC_CROSS)); 
  pContainerViewerProps->PutHorizontalResizeCursor (PicHolder.GetPictureDispatch());
      PicHolder.CreateFromIcon(LoadCursor(NULL, IDC_SIZE)); 
  pContainerViewerProps->PutBothResizeCursor (PicHolder.GetPictureDispatch());
  pContainerViewerProps->PutAutoScroll (TRUE); 
  pContainerViewerProps->PutRulerStyle (CONVIEW_RULERSTYLE_INVERT); 
  pContainerViewerProps->PutCellMaintenance (CONVIEW_CELLSMAINTENANCE_SIZE); 
  pContainerViewerProps->PutShowFreezeText (TRUE); 
  pContainerViewerProps->PutCellBorderStyle (CONVIEW_PEN_STYLE_SOLID); 
  pContainerViewerProps->PutTextQuality (CONVIEW_TEXTQUALITY_DEFAULT); 

      //Apply these properties
      pLEADContainerViewer->SetContainerProperties (pContainerViewerProps, 0); 

      pLEADContainerViewer->SetAppearance (CONVIEW_APPEARANCE_THREED); 
   
      for(int i = 0; i < pLEADContainerViewer->GetCellCount (); i++)
      {      
         // Change the number of sub-rows and sub-cols. 
         pLEADContainerViewer->Cell (i).SetSubRowCount (2); 
         pLEADContainerViewer->Cell(i).SetSubColumnCount (2); 

         //Set cell properties
         pLEADContainerViewer->Cell(i).SetEnableChangeOnMove (VARIANT_TRUE); 
         pLEADContainerViewer->Cell(i).SetIndividual (VARIANT_TRUE); 
         pLEADContainerViewer->Cell(i).SetIsFit (VARIANT_TRUE); 
         pLEADContainerViewer->Cell(i).SetSelect (VARIANT_TRUE); 
         pLEADContainerViewer->Cell(i).SetFreeze (VARIANT_FALSE); 

     pLEADContainerViewer->Cell(i).SetShowRuler (CONVIEW_SHOWRULER_BOTH); 
     pLEADContainerViewer->Cell(i).SetShowTags (CONVIEW_SHOWTAGS_SHOW); 
      }

      pLEADContainerViewer->SetFirstVisibleRow (0); 
      

      pRasterIO->Release();
      pContainerViewerProps->Release();
      pRaster->Release();

   }
   CATCH_ALL(e) 
   {
       e->ReportError();
   }
   END_CATCH_ALL

}