Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

Zooming In on a Selection: Step 4

Show in webframe

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. The code should appear as follows:

case WM_LBUTTONDOWN:
   /* Save the starting position in screen pixels (used by GDI functions) */
   StartGDIX = LOWORD(lParam);
   StartGDIY = HIWORD(lParam);

   /* Use the mouse position's percentage offsets in the image rectangle
   to determine the pixel offsets in the bitmap.
   Using percentages allows for the possibility that the image is zoomed. */  
   StartPixelX = MulDiv(BITMAPWIDTH(&LeadBitmap), StartGDIX - rLeadDest.left, DisplayWidth);
   StartPixelY = MulDiv(BITMAPHEIGHT(&LeadBitmap), StartGDIY - rLeadDest.top, DisplayHeight);

   /* Initialize a variable used when the WM_MOUSEMOVE event outlines the area */
   FirstDraw = TRUE;
   return (0);

Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.