Creates the Pan Window and associates it with hWndParent.
#include "l_bitmap.h"
L_LTDIS_API L_INT L_CreatePanWindow(hWndParent, pBitmap, ulDisplayFlags, nLeft, nTop, nWidth, nHeight, pszClassName, hIcon, hCursor, bSysMenu, pfnPanCallback, pUserData)
Handle to the main window, which will be displaying pBitmap
. This window will not be the parent, but will be associated with the PanWindow.
Pointer to the bitmap handle referencing the bitmap to be displayed in the PanWindow.
Flags which determine how the image is painted in the Pan Window. For values, refer to Flags for the L_SetDisplayMode Function.
X coordinate for the origin of the Pan Window.
Y coordinate for the origin of the Pan Window.
Requested width of the Pan Window's client area. The actual width will depend on the aspect ratio of the image pointed to by pBitmap
and the values passed for nWidth and nHeight
.
Requested height of the Pan Window's client area. The actual height will depend on the aspect ratio of the image pointed to by pBitmap
and the values passed for nWidth
and nHeight.
Character string containing the class name for which to register the Pan Window. This must be a valid string, and should be related to your application, to avoid conflicting with an existing registered window class name.
Handle to the icon to use for the Pan Window. Pass NULL for no icon.
Handle to the cursor to use for the Pan Window.
TRUE to include the system menu on the Pan Window. FALSE to omit it.
Callback function for doing custom painting and getting notification of Pan Rect updates.
Void pointer that you can use to pass one or more additional parameters that the callback function needs.
To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
If the additional parameters are not needed, you can pass NULL in this parameter.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function creates the Pan Window and associates it with hWndParent
.
The Pan Windows width and height will be adjusted to account for the aspect ratio of the image pointed to by pBitmap
. You must specify a PANWNDCALLBACK callback function to do custom painting or be notified of interactive Pan Rect updates. To position the Pan Rect, call the L_UpdatePanWindow function. You must use L_DestroyPanWindow to destroy the Pan Window and all data associated with it.
Note: the calling application is responsible for coordinating the Pan Window's Pan Rect and the actual display rect of the main window.
Call L_UpdatePanWindow to make the window visible, and set the Pan Rect.
Win32, x64, Linux.
Add the following code to the end of SCRLZOOM.C:
The following provides a quick and easy method for viewing a Pan Window.
To make this sample easier to drop into place, a number of globals have been used.
For the full sample code for the Pan Window, refer to CHILD.C of the DEMO example program.
//Add the following code to SCRLZOOM.C in the SCRLZOOM demo.
/************************************************************************
#define PANWINDOW_CLASS TEXT("L_PANWINDOW_32")
L_UINT32 ulFlags = 0;
L_HWND ghPanWindow;
L_BOOL bUpdatePan = FALSE;
L_BOOL bPanWindow = FALSE;
L_INT gnZoom = 100;
L_HWND ghBitmapWnd;
L_BOOL fFitImage = FALSE;
L_VOID CreatePanWindowExample(L_HWND hWnd);
L_VOID EXT_CALLBACK PanWindowCallback(L_HWND hPanWindow, L_HWND hWndParent, L_UINT uMsg, LPRECT prcPan, L_VOID *pUserData);
// Add the following code to the switch statement in MainWndProc in SCRLZOOM.C, right after HANDLE_MSG (hWnd, WM_DESTROY, Window_OnDestroy);
case WM_KEYDOWN:
CreatePanWindowExample(hWnd);
// Add the following code immediately following the call to L_PaintDC (hDC, &Data.Bitmap, NULL, NULL, &Data.rcView, &ps.rcPaint, SRCCOPY); in the Window_OnPaint function in SCRLZOOM.C :
L_UpdatePanWindow(ghPanWindow, &Data.Bitmap, ulFlags, RGB(255, 0, 0), TEXT("Pan Window"), &Data.rcView);
// Add the following code immediately before PostQuitMessage(0); in WIndow_OnDestroy in SCRLZOOM.C :
bPanWindow = FALSE;
if (ghPanWindow)
L_DestroyPanWindow(ghPanWindow);
// Add the following code to the end of SCRLZOOM.C :
L_VOID CreatePanWindowExample(L_HWND hWnd)
{
// if no PanWindow, create one
if (bPanWindow == 0)
{
bUpdatePan = TRUE;
ulFlags = DISPLAYMODE_SCALETOGRAY;
L_CreatePanWindow(hWnd, &Data.Bitmap, ulFlags, 0, 0, 150, 150, PANWINDOW_CLASS, NULL, NULL, TRUE, (PANWNDCALLBACK)PanWindowCallback, NULL);
ghBitmapWnd = hWnd;
L_UpdatePanWindow(ghPanWindow, &Data.Bitmap, ulFlags, RGB(255, 0, 0), TEXT("Pan Window"), &Data.rcView);
}
return;
}
L_VOID EXT_CALLBACK PanWindowCallback(L_HWND hPanWindow,
L_HWND hWndParent,
L_UINT uMsg,
LPRECT prcPan,
L_VOID* pUserData)
{
POINT Pt;
L_INT dy, dx;
// This adjusts the gnZoom value when the main window is zoomed.
if (Data.nScalar > 0)
gnZoom = (Data.nScalar + 1) * 100;
else if (Data.nScalar < 0)
gnZoom = (Data.nScalar - 1) * 100;
else if (Data.nScalar == 0)
gnZoom = 100;
switch(uMsg)
{
case PANWIN_CREATED:
ghPanWindow = hPanWindow;
break;
case PANWIN_UPDATED:
Pt.x = prcPan->left;
Pt.y = prcPan->top;
dx = Data.rcView.right - Data.rcView.left;
dy = Data.rcView.bottom - Data.rcView.top;
Data.rcView.left = -min(Data.nHScrollMax, MulDiv(Pt.x, gnZoom, 100));
Data.rcView.right = Data.rcView.left + dx;
Data.rcView.top = -min(Data.nVScrollMax, MulDiv(Pt.y, gnZoom, 100));
Data.rcView.bottom = Data.rcView.top + dy;
bUpdatePan = FALSE;
Data.nHScrollPos = -Data.rcView.left;
Data.nVScrollPos = -Data.rcView.top;
SetScrollPos(ghBitmapWnd, SB_HORZ, Data.nHScrollPos, TRUE);
SetScrollPos(ghBitmapWnd, SB_VERT, Data.nVScrollPos, TRUE);
InvalidateRect(ghBitmapWnd, NULL, FALSE);
UpdateWindow(ghBitmapWnd);
break;
case PANWIN_DESTROYED:
hPanWindow = NULL;
bPanWindow = FALSE;
break;
}
return;
}
*************************************************************/
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document