Cropping an Image

 

You can crop an image using the CropDIB function/method of the BiDIB DLL/OCX. The Crop property and Crop event allow you to select an area to crop using a mouse with the ActiveX control.

 

[C++]

 

/* Cropping an image */

 

#include “BiDIB.h”

 

HDIB hDibNew;

 

/* 1. parameter: Handle of the DIB to scale

   2. parameter: Left position

   3. parameter: Top position

   4. parameter: Right position

   5. parameter: Bottom position */                

 

HDibNew = CropDIB(hDib, 0, 0, 50, 50);

 

if (!hDibNew)

{

            // Error

}

 

[C#]

 

/* Cropping an image */

 

long hDibNew;

 

/* 1. parameter: Handle of the DIB to scale

   2. parameter: Left position

   3. parameter: Top position

   4. parameter: Right position

   5. parameter: Bottom position */

 

hDibNew = BiDIB.CropDIB(hDib, 0, 0, 50, 50);

 

if (hDibNew == 0)

{

            // Error

}