WindowLevelActionSample Example for Visual C++ 5.0

void WindowLevelActionSample(CLEADRasterContainerViewer * pLEADContainerViewer) 
{
   TRY
   {
      pLEADContainerViewer->SetEnableMethodErrors (TRUE); 

      // Activate Window level action if the action is not activated
      if(!pLEADContainerViewer->WindowLevelAction ().GetUse ())
         pLEADContainerViewer->WindowLevelAction().ActivateAction (TRUE, 0); 
      // Select left mouse button to control window level parameters. 
      pLEADContainerViewer->WindowLevelAction().SetMouseButtonAction (CONVIEW_MOUSE_BUTTON_LEFT, CONVIEW_ACTION_ALLCELLS); 

      // Select left, right, up, and down keys to control window level parameters. 
      pLEADContainerViewer->WindowLevelAction().SetModifier (CONVIEW_KEY_CTRL); 
      pLEADContainerViewer->WindowLevelAction().SetKey (VK_DOWN); 
      pLEADContainerViewer->WindowLevelAction().SetKeyboardAction (CONVIEW_MOUSEMOVE_DOWN); 
      pLEADContainerViewer->WindowLevelAction().SetKey(VK_UP); 
      pLEADContainerViewer->WindowLevelAction().SetKeyboardAction(CONVIEW_MOUSEMOVE_UP); 
      pLEADContainerViewer->WindowLevelAction().SetKey(VK_LEFT); 
      pLEADContainerViewer->WindowLevelAction().SetKeyboardAction(CONVIEW_MOUSEMOVE_LEFT); 
      pLEADContainerViewer->WindowLevelAction().SetKey(VK_RIGHT); 
      pLEADContainerViewer->WindowLevelAction().SetKeyboardAction(CONVIEW_MOUSEMOVE_RIGHT); 

      // Select Window level cursor. 
      CPictureHolder PicHolder; 
      if(PicHolder.CreateFromIcon(LoadCursor(NULL, IDC_CROSS))) 
      {
         pLEADContainerViewer->WindowLevelAction().SetCursor (PicHolder.GetPictureDispatch());
      }
      // Specify Window level parameters. 
      pLEADContainerViewer->WindowLevelAction().SetChange (100); 
      pLEADContainerViewer->WindowLevelAction().SetCircularMouseMove (TRUE); 
      pLEADContainerViewer->WindowLevelAction().SetStartColor (RGB(0, 0, 0)); 
      pLEADContainerViewer->WindowLevelAction().SetEndColor (RGB(255, 255, 255)); 
      
      // Set Window level parameters. 
      pLEADContainerViewer->WindowLevelAction().SetAction (0, 0, CONVIEW_ACTIONLEVEL_CONTAINER); 

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