Programatically Zooming

You can zoom an image with BiDisp control programmatically. You can use the BZoomStep or ZoomArea functions or methods.

 

 

[C++]

 

#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);

            DispZoom();

}

 

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;

 

         if(hDib)

         {

            DisplayDIBStart(m_hWnd, hDib, &sDisplay.rOrigo,

                        &rScale, wDisplayMode, &sDisplay);

         }

}

 

[VB]

 

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

 

[C#]

 

private void ZoomImage()

{

         int iLeft, iTop, iBottom, iRight;

 

         iLeft = iTop = 10;

         iRight = iBottom = 30;

 

         // parameters: Zooming rectnagle coordinates

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

}