ImageGear Professional DLL v17.1 for Windows Accusoft
IG_GUI_select_track_mouse
Send Feedback  
ImageGear Professional DLL v17.1 for Windows > API Reference Guide > Core Component API Reference > Core Component Functions Reference > GUI Functions > GUI Mouse Selection Functions > IG_GUI_select_track_mouse

Glossary Item Box

This function is called when you want to use the mouse to delineate a rectangle within an image window.

Declaration:

  Copy Code
AT_ERRCOUNT ACCUAPI IG_GUI_select_track_mouse ( 
        HIGEAR hIGear, 
        DWORD dwGrpID, 
        HWND hWndImage, 
        INT nX, 
        INT nY, 
        LPFNIG_GUISELECT lpfnSelect, 
        LPVOID lpPrivate 
);

Arguments:

hIGear HIGEAR handle of image.
dwGrpID Display group identifier, used for drawing image in the image window.
hWndImage Handle of the Image window.
nX The X position of the left mouse button click.
nY The Y position of the left mouse button click.
lpfnSelect Far pointer to the GUI Select callback function. This is called when a rectangle is created.
lpPrivate Far pointer to private data (passed to the callback function).

Return Value:

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

Supported Raster Image Formats:

All pixel formats supported by ImageGear Professional.

Sample:

Display, Clipboard

Example:

  Copy Code
PFNIG_GUISELECT   MyGUISelectCB;/* Called when rect delineated  */
HIGEAR  hIGear;/* HIGEAR handle of image     */
struct  tagMyPriv  {
   BOOL     bRectWasSelected; /* TRUE=User delineated a rect  */
   AT_RECT  rcUserRect:      /* This is the rectangle      */
   }         PrivateStruct;  /* Name of private data area    */
/* Window-message handling routine:    */
LPARAM CALLBACK  MsgHandler
        ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
 ...
switch ( msg )
  {
  CASE WM__LBUTTONDOWN:
         ...
        IG_GUI_select_track_mouse ( hIGear, IG_GRP_DEFAULT, hWnd, 
        LOWORD(lParam), HIWORD(lParam), MyGUISelectCB, 
        (LPVOID) &PrivateStruct );
         ...
  }
 ...
}
VOID ACCUAPI  MyGUISelectCB ( LPVOID lpPrivate, 
        LPAT_RECT lprcRectSelected )
/* This function will record the rectangle selected, in PrivateStruct, pointed to by
lpPrivate. */
{
struct tagMyPriv *   structPtr; /* Will point to PrivateStruct */
structPtr =  lpPrivate;      /* Copy the pointer */
structPtr -> bRectWasSelected  =  TRUE; /* Indicate a rect here */
structPtr -> rcUserRect        =  *lprcRectSelected;  /* Copy rect */
return;      /* Done */
}

Remarks:

Call this function in response to the windows message WM_LBUTTONDOWN. The mouse position is followed while the left mouse button is down. When the left mouse button is released, your lpfnSelect callback function is called with the coordinates of the rectangle that was described. The callback function may use the rectangle data in any way.

If aspect ratio preservation is in effect for the image (that is, if the aspect ratio setting is anything other than IG_DSPL_NOT_FIXED), then the dragged rectangle will automatically be aspect ratio corrected.

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

You cannot use IG_GUI_..._track_mouse() functions with a WM_RBUTTONDOWN message. ImageGear responds only to left mouse button clicks.
©2012. Accusoft Corporation. All Rights Reserved.