ImageGear for C and C++ on Windows v19.5 - Updated
Mouse Tracking
User Guide > How to Work with... > Common Operations > Viewing > GUI Features > Mouse Tracking

ImageGear provides the function IG_GUI_select_track_mouse() to assist you when you want to let your user select a rectangular portion of an image, or for some other purpose draw or delineate a rectangle in an image window. As with the other IG_GUI_ ..._track_mouse() functions, the call to this function is placed in a Windows message handling segment for message WM_LBUTTONDOWN.

You cannot use IG_GUI_..._track_mouse() with a WM_RBUTTONDOWN message. ImageGear only responds to left mouse button clicks.

Issue the call, giving the (x, y) coordinates at which the mouse button was pressed, and ImageGear will track the mouse as it is moved with the button held down. When the mouse button is released, the opposite corner of a rectangle is thus specified, and ImageGear invokes your LPFNIG_GUISELECT callback function, passing it the coordinates of the rectangle that the user delineated. Your callback function (declared in the call to IG_GUI_select_track_mouse()) may draw the specified rectangle, or zoom the image to it, or do anything else with this information that you want your application to do. This function is independent of the other GUI groups such as Pan, Magnify, etc., and can be used in any window.

If the HIGEAR image's aspect ratio setting is IG_DSPL_ASPECT_FIXED (that is, if aspect ratio preservation is in effect for the image), then the rectangle that the user draws out will automatically be aspect-ratio corrected.