L_StartZoomViewAnnEdit

"l_bitmap.h"

L_LTZMV_API L_INT L_StartZoomViewAnnEdit(hWnd, pZoomViewAnnEdit)

HWND hWnd;

/* handle to a window */

pZOOMVIEWANNEDIT pZoomViewAnnEdit;

/* pointer to a structure that specifies the annotation options */

Puts the Zoom Views that are attached to the specified window into annotation edit mode.

Parameter

Description

hWnd

Handle to a window.

pZoomViewAnnEdit

Pointer to a ZOOMVIEWANNEDIT structure that specifies the annotation edit options to set.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function is used together with L_StopZoomViewAnnEdit to toggle the annotation edit mode. For information on using a zoom view with annotations, see the documentation for L_CreateZoomView and ZOOMVIEWPROPS. Once you have properly set up a zoom view that is using annotations, call the L_StartZoomViewAnnEdit function to display any annotations in edit mode or design mode. In edit mode, annotations can be created, and existing annotations can be modified, or deleted.  To end the annotation edit mode (or to display the annotations in run-mode), call the function L_StopZoomViewAnnEdit function.

Required DLLs and Libraries

LTZMV
LTANN

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:

L_WindowHasZoomView, L_GetZoomViewProps, L_UpdateZoomView, L_DestroyZoomView, L_GetZoomViewsCount, L_StopZoomViewAnnEdit

Topics:

Raster Image Functions: Displaying Images

 

Using the Zoom View

Example

This sample shows how to toggle the annotation edit mode of a Zoom View from design mode to run mode. It is part of the ZoomView demo that ships with the toolkit.

// WINDOWDATA is used to associate window data with each window that contains zoom view objects.
// Each window will have a valid annotation hAutomation object, and a valid annotation hContainer object.
// For details on creating the hAutomation object and the hContainer object, see the ZoomView demo
typedef struct tagWINDOWDATA
{
   L_INT nActiveZoomView;
   HANNOBJECT hContainer;
   HANNOBJECT hAutomation;

   // Other window data...
} WINDOWDATA, *LPWINDOWDATA ;

HWND ghwndToolbar = NULL;
L_INT gnAnnUserMode = ANNUSER_DESIGN;

BOOL CALLBACK AnnEnumAnnUserModeProc(HWND hwnd, LPARAM lParam)
{
   LPWINDOWDATA pData = (LPWINDOWDATA)(LONG_PTR)GetWindowLongPtr(hwnd,GWLP_USERDATA);
   L_INT nAnnUserMode = (L_INT)lParam;
   if (pData && pData->hContainer)
   {
      L_INT nRet = L_AnnSetUserMode(pData->hContainer, nAnnUserMode);
      if (nRet == SUCCESS)
      {
         if (nAnnUserMode == ANNUSER_DESIGN)
         {
            ZOOMVIEWANNEDIT ZoomViewAnnEdit;
            memset(&ZoomViewAnnEdit, 0, sizeof(ZoomViewAnnEdit));
            ZoomViewAnnEdit.uStructSize = sizeof(ZoomViewAnnEdit);
            ZoomViewAnnEdit.hAnnAutomation = pData->hAutomation;
            ZoomViewAnnEdit.hWndAnnToolbar = ghwndToolbar;
            L_StartZoomViewAnnEdit(hwnd, &ZoomViewAnnEdit);
         }
         else
         {
            L_StopZoomViewAnnEdit(hwnd);
         }
      }
   }
   return TRUE; //Continues enumeration
}

// hwnd - handle to the parent window of the zoom view
// bAnnotationEditMode  - true: change to annotation edit mode
//                      - false: change to annotation run mode
L_INT ChangeZoomViewAnnotationMode(HWND hwnd, L_BOOL bAnnotationEditMode)
{
   if (bAnnotationEditMode)
   {
      if (gnAnnUserMode != ANNUSER_DESIGN)
      {
         if (!ghwndToolbar)
         {
            POINT ptToolbar = {0,0};
            L_AnnCreateToolBar(hwnd, &ptToolbar,
               ANNTOOLALIGN_LEFT | ANNTOOLALIGN_TOP, FALSE, &ghwndToolbar, 0, NULL); 
         }
         if (ghwndToolbar)
            ShowWindow(ghwndToolbar,SW_NORMAL);
         EnumChildWindows(GetParent(hwnd), AnnEnumAnnUserModeProc, ANNUSER_DESIGN);
         gnAnnUserMode = ANNUSER_DESIGN;
      }
   }
   else // annotation run mode
   {
      if (gnAnnUserMode != ANNUSER_RUN)
      {
         if (ghwndToolbar)
            ShowWindow(ghwndToolbar,SW_HIDE);
         EnumChildWindows(GetParent(hwnd), AnnEnumAnnUserModeProc, ANNUSER_RUN);
         gnAnnUserMode = ANNUSER_RUN;
      }
   }
   return SUCCESS;
}