Text Box: Volume 11, Issue 1

The Black Ice Imaging Toolkits include BiDisp controls which allow developers to display images for their users,  You can zoom into an image with BiDisp control either through user intervention or programmatically. This article focuses on how to programmatically zoom using the BZoomStep or ZoomArea functions or methods.

Text Box: Page #
Text Box: Imaging Tips and Tricks - Programmatically Zooming


#include “BiDisp.h”


void CMyView::ZoomStep()


            // 1. parameter (HWND): Window handle to display image

// 2. parameter (LPPOINT): Coordinates of the mouse pointer

// 3. parameter (ZOOMFLAG): Determines the operation of zoom.

// 4. parameter (LPZOOMSTRUCT): Zoom structure

// 5. parameter (DISPLAYSTRUCT): Display information structure

            BZoomStep(m_hWnd, &rScale, zoomflg, &m_zm, &sDisplay);




void CMyView::DispZoom()


         CopyRect(&rScale, &m_zm.rScaleOut);

         SetRect(&sDisplay.rOrigo, 0, 0, 0, 0);

         sDisplay.rOrigo.left  = m_zm.pOrigoOut.x;

         sDisplay.rOrigo.top   = m_zm.pOrigoOut.y;




            DisplayDIBStart(m_hWnd, hDib, &sDisplay.rOrigo,

                        &rScale, wDisplayMode, &sDisplay);




Private Sub ZoomImage()

            Dim iLeft As Long

            Dim iTop As Long

            Dim iRight As Long

            Dim iBottom As Long


            iLeft = 10

            iTop = 10

            iRight = 30

            iBottom = 30


            ‘ parameters: Zooming rectnagle coordinates

            BiDisp.ZoomArea (iLeft, iTop, iRight, iBottom)

End Sub


private void ZoomImage()


         int iLeft, iTop, iBottom, iRight;


         iLeft = iTop = 10;

         iRight = iBottom = 30;


         // parameters: Zooming rectnagle coordinates

         BiDisp.ZoomArea(iLeft, iTop, iRight, iBottom);