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);
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document