LBitmapWindow::Repaint

#include "ltwrappr.h"

L_VOID LBitmapWindow::Repaint(pRect=NULL)

LPRECT pRect;

/* pointer to a rectangle structure */

Repaints the class object's window. Only the specified rectangle will be repainted.

Parameter

Description

pRect

Pointer to a rectangle structure that describes the rectangle to be repainted. Pass NULL to repaint the entire window.

Returns

None

Required DLLs and Libraries

LTDIS
LTDLG
LTEFX
LTFIL
LTIMG
LTSCR
LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

Class Members

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmapWindow__RepaintExample(HWND hWndParent)
{
   L_INT nRet;
   LBitmapWindow  LeadBWnd ;
   L_UINT         uZoomMode ;
   RECT           rectZoom ;
   
   nRet = LeadBWnd.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")));
   if (nRet == SUCCESS)
   {
      if (LeadBWnd.CreateWnd(hWndParent, TRUE, 0, 0, 100, 100) == NULL)
         return 0;
   
      if (LeadBWnd.IsAutoPaintEnabled() == FALSE)
      {
         // stop paint
         LeadBWnd.EnableAutoPaint(TRUE) ;
      }
      /* repaint the image, but paint stopped, 
         then the Repaint will not paint the image */
      LeadBWnd.Repaint() ;
      // start paint with new updates
      LeadBWnd.EnableAutoPaint(FALSE) ;
      // repaint the image
      LeadBWnd.Repaint() ;
      // get zoom mode for current bitmap window 
      uZoomMode = LeadBWnd.GetZoomMode();
      if (uZoomMode != ZOOM_FACTOR)
      {
         uZoomMode = ZOOM_FITHEIGHT ;
         // change the zoom mode for current bitmap window 
         nRet =LeadBWnd.SetZoomMode(uZoomMode) ;
         if(nRet !=SUCCESS)
            return nRet;
      }
      //...
      //...
      if (LeadBWnd.GetHorzLineStep() != 2)
         LeadBWnd.SetHorzLineStep(2) ;
      if (LeadBWnd.GetVertLineStep() != 2)
         LeadBWnd.SetVertLineStep(2) ;
      // check if auto scroll bars is enable or not 
      if (LeadBWnd.IsAutoScrollEnabled() == FALSE)
         LeadBWnd.EnableAutoScroll(TRUE) ;
      // fill zoom rect to use it in ZoomToRect 
      rectZoom.left  = 50 ;
      rectZoom.top   = 50 ;
      rectZoom.right = 75 ;
      rectZoom.bottom= 75 ;
      nRet =LeadBWnd.ZoomToRect(rectZoom) ;
      if(nRet !=SUCCESS)
         return nRet;
      //...
      //...
      // use ScrollBars (Horizontal & Vertical)
      
      // 10 = the distance to scroll the bitmap horizontally.
      // 20 = the distance to scroll the bitmap horizontally.
      LeadBWnd.ScrollBy( 10, 20) ;
      
      // go to 10 position on horizontal scroll in bitmap
      // go to 20 position on vertical scroll in bitmap
      LeadBWnd.ScrollTo( 10, 20) ;
   }
   else
      return nRet;
   return SUCCESS ;
}