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
}
[VB]
‘ Cropping an image
Dim BiDIBobj as Object
Dim hDibNew as Long
‘ 1. parameter: Handle of the DIB to scale
‘ 2. parameter: Left position
‘ 3. parameter: Top position
‘ 4. parameter: Right position
‘ 5. parameter: Bottom position
Set BiDIBobj = CreateObject("BIDIB.BIDIBCtrl.1")
hDibNew = BiDIBobj.CropDIB(hDib, 0, 0, 50, 50)
Set BIDIBObj = Nothing
If hDibNew = 0 Then
‘ Error
End If
[C#]
/* Cropping an image */
int 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
}