Zooming In on a Selection

This topic describes how to let the user select an area with a mouse and zoom in on the selected area. In this topic, you learn the following:

To be as simple and specific as possible, these instructions describe how to modify the EZFUNC example program. If you want to test the sample code, you should make a copy of the EZFUNC program, and modify the copy. The display rectangles used in this program are described in Fitting an Image to a Window.


Step 1 On WIN32 systems, include the GDI library so that we can display an outline of the selection.


Step 2 Modify the EZFUNC.H file to add global variables for tracking coordinates.


Step 3 In the MainWndProc function, add some new local variables to support the GDI functions.


Step 4 In the MainWndProc function, add code to process WM_LBUTTONDOWN messages. This code initializes coordinates for defining two rectangles. One rectangle is relative to the client area and is used with the GDI functions to outline the selection. The other rectangle is relative to the bitmap and is used to zoom in by defining the source rectangle for painting.


Step 5 In the MainWndProc function, add code to process WM_MOUSEMOVE messages. This code outlines the selection using GDI functions .


Step 6 In the MainWndProc function, add code to process WM_LBUTTONUP messages. This code defines the source and destination rectangles for painting, and forces a repaint.


Step 7 In the MainWndProc function, add code to process WM_RBUTTONDOWN messages. This code returns to the display of the full image when the user clicks the right mouse button.

The following topics provide detailed descriptions of these steps, with code that you can copy from the online help and paste into the sample program.

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help