ImageGear for C and C++ on Windows v20.0 - Updated
IG_GUI_pan_track_mouse
API Reference Guide > Core Component API Reference > Core Component Functions Reference > GUI Functions > GUI Pan Functions > IG_GUI_pan_track_mouse

This function can be called while processing the Windows left-mouse-button-down message WM_LBUTTONDOWN.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_GUI_pan_track_mouse ( 
        HIGEAR hIGear, 
        DWORD dwGrpID, 
        HWND hWndPan, 
        INT nX, 
        INT nY 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
dwGrpID DWORD Identifier of group which is used for drawing image in the parent window.
hWndPan HWND Handle of GUI Image or Pan window.
nX INT X position of left mouse button click.
nY INT Y position of left mouse button click.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

Panning, Display

Example:

 
Copy Code
HIGEAR    hIGear;     /* HIGEAR handle of image in parent window */
HWND     hWndParent;  /* Windows window handle of that window */
HWND     hWndImage;  /* Windows handle of Image window    */
AT_ERRCOUNT nErrcount;   /* Returned count of errors   */
 ...
/* Create a Pan window for the image in window hWndParent: */
nErrcount = IG_GUI_pan_window_create_ex ( hIGear, IG_GRP_DEFAULT, hWndParent, hWndImage,
WS_CHILD|WS_VISIBLE, "I.G. Pan Window", 50, 50, 200, 200, &hWndPan );
/* Message-Handling routine: */
LPARAM CALLBACK  MsgHandler (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
{
 ...
switch (msg)
        {
        case WM_LBUTTONDOWN:
        /* if occurred in the Pan window: */
        IG_GUI_pan_track_mouse ( hIGear, IG_GRP_DEFAULT, hWndPan,
LOWORD(lParam),HIWORD(lParam) );
/* The above will display in the Pan window, the location where the mouse is being clicked
in the parent image window. */
         ...
        }
 ...
}
/* See also sample application, PAN */

Remarks:

If the pan window's parent window is a GUI image window (see functions IG_GUI_window_create(), and IG_GUI_window_associate()), then calling IG_GUI_pan_track_mouse() will show, in the parent window, the portion of the image indicated by the mouse location in the pan window. This can be used to let the user slide (pan) the image around in the parent window, by moving the mouse in the pan window.

See also IG_GUI_pan_window_create() function.

You can obtain (nX, nY), the coordinates of the left mouse button click, from the parameters passed by Windows with the WM_... message.

You cannot use IG_GUI_..._track_mouse() with a WM_RBUTTONDOWN message. ImageGear only responds to left mouse button clicks.
Is this page helpful?
Yes No
Thanks for your feedback.