ImageGear for C and C++ on Windows v20.5 - Updated
Pan Window
User Guide > How to Work with ... > Common Operations > Viewing > GUI Features > GUI Windows > Pan Window

To create a GUI pan window, invoke IG_GUI_pan_window_create_ex(). This function creates a new window on your screen in which the HIGEAR image you name in the call will be displayed in its entirety. In this call you also name a second window, called the parent window.

As the user of your application moves the mouse around in the pan window, you can have ImageGear pan (slide) the image in the parent window, such that you see (in the parent window) the portion of the image selected by the mouse's position in the pan window. Here is how to do it:

  1. First, make the window that is designated to be the parent window a GUI image window. You do this by calling IG_GUI_window_associate() if this window already exists, or by calling IG_GUI_pan_window_create_ex() to create the parent window.
  2. Next, call IG_GUI_pan_window_create_ex() to create the pan window and designate its parent. You should name the same HIGEAR image when creating the pan window that is in its parent window. In the pan window, you automatically get the whole image. However, the parent window is under your control. You can, for example, define its device rectangle (e.g., zoom it) to obtain the desired scaling. Generally, for large images the parent window's device rectangle should be significantly larger than the client rectangle so that only a portion of the image appears in the client window at any given moment.
  3. To handle the mouse movement, you include a call to function IG_GUI_pan_track_mouse() in your Windows window-message-handling routine when handling a WM_LBUTTONDOWN message.

ImageGear does not currently support tracking of the right mouse button, only the left.

Your IG_GUI_pan_track_mouse() call causes ImageGear to automatically reposition the image in the parent window.

If your parent window is not a GUI image window (that is, if you did not call IG_GUI_window_associate() or IG_GUI_window_create() for this window), then your IG_GUI_pan_track_mouse() call generates Windows WM_PAINT and WM_... scroll messages that can be used to slide the image in the parent window. However, ImageGear does not intercept these messages and handle them automatically. Your application must detect the messages and execute calls to cause the scrolling or other effects you want.

When your application uses a pan window, you can use the Windows call DestroyWindow() to remove it. You can disassociate the parent window from GUI by calling IG_GUI_window_associate() with BOOL argument bAssociate = FALSE. If you call function IG_GUI_window_CB_register(), whenever a GUI image window is destroyed, your LPFNIG_GUIWINDESTROY callback function is called.

An additional GUI pan function, IG_GUI_pan_update(), is provided so that you can tell ImageGear to update (refresh) the pan window if the HIGEAR image that is being displayed in it has changed in memory.

Is this page helpful?
Yes No
Thanks for your feedback.