Use DetectSkewAngle and DetectSkewAngleWithoutBBorder functions/methods of the BiDocImg DLL/OCX for detecting the angle of skewing.
[C++]
/* Detecting the skew angle of an image*/
#include “BiDocImg.h”
/* 1. parameter: Handle of the DIB to filter
2. parameter: Paper white or black
3. parameter: Show progress
4. parameter: Handle of parent window */
int iAngle = DetectSkewAngle(hDib, TRUE, TRUE,
AfxGetMainWnd()->m_hWnd);
[C#]
/* Detecting the skew angle of an image*/
int iAngle = BiDocImg.DetectSkewAngle(hDib, true, true);