Available in the LEADTOOLS Imaging toolkit. |
BorderRemove example for Visual Basic
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Public hRgnAll As Long
Private Const RGN_OR = 2
Dim szBorder As String
CombineRgn hRgnAll, hRgnAll, hRgn, RGN_OR
Select Case (uBorderToRemove)
Case BORDER_TOP:
szBorder = "Top"
Case BORDER_LEFT:
szBorder = "Left"
Case BORDER_RIGHT:
szBorder = "Right"
Case BORDER_BOTTOM:
szBorder = "Bottom"
End Select
Debug.Print "Border - " & szBorder & " Bounds:" & CStr(fBoundingRectLeft) & ", " & CStr(fBoundingRectTop) & ", " & CStr(fBoundingRectWidth) & ", " & CStr(fBoundingRectHeight); ""
LEAD1.DocCleanSuccess = SUCCESS_REMOVE
Private Sub LEAD1_BorderRemove (ByVal hRgn As Stdole.OLE_HANDLE, ByVal uBorderToRemove As Long, ByVal fBoundingRectLeft As Single, ByVal fBoundingRectTop As Single, ByVal fBoundingRectWidth As Single, ByVal fBoundingRectHeight As Single)
Dim szBorder As String
CombineRgn hRgnAll, hRgnAll, hRgn, RGN_OR
Select Case (uBorderToRemove)
Case BORDER_TOP:
szBorder = "Top"
Case BORDER_LEFT:
szBorder = "Left"
Case BORDER_RIGHT:
szBorder = "Right"
Case BORDER_BOTTOM:
szBorder = "Bottom"
End Select
Debug.Print "Border - " & szBorder & " Bounds:" & CStr(fBoundingRectLeft) & ", " & CStr(fBoundingRectTop) & ", " & CStr(fBoundingRectWidth) & ", " & CStr(fBoundingRectHeight); ""
LEAD1.DocCleanSuccess = SUCCESS_REMOVE
End Sub