Hi!
The whole project I think will be more confusing because it's a big application, with a lot of code and it wouldn't be relevant, so I'm going to copy here the parts of the code that refer to OCR, ok? My natural language is Portuguese, so some variable names and the like may be in this language.
Basically it's the code below. Just what I talked about before, it already happens:
Code:
Private Sub OCRCamera_Click
'
' Sub to start OCR by activating the camera
'
OCRTextoEscaneado.Text=""
Try
OCRPreview.startScanning
Catch
Log(LastException)
End Try
'
OCRPreview.Visible=True
End Sub
Private Sub OCRCameraDesligar_Click
'
' Finish OCR. Turn off camera.
'
Try
OCRPreview.stopScanning
Catch
Log(LastException)
End Try
OCRPreview.Visible=False
OCRPainel.Visible=False
PainelTela.Visible=False
End Sub
Private Sub OCRLer_Click
'
' To take a text from camera
'
Private Blocos As List
Private Texto As String
Private Altura As Int
Private Contador As Int
'
' Start Scan
'
Try
OCRPreview.startScanning
Catch
Log(LastException)
End Try
Sleep(0)
'
' Blocos
'
Blocos.Initialize
Blocos = OCRPreview.TextBlocks
'
' Turn scan off
'
Try
OCRPreview.stopScanning
Catch
Log("Nada")
End Try
'
OCRPreview.Visible=False
Sleep(0)
'
If (Blocos.IsInitialized=False) Then
Texto=""
Else
'
For Contador = 0 To Blocos.Size - 1
Texto = Texto & Blocos.Get(Contador) & CRLF
Next
End If
'
Texto=Texto.Trim
'
If (Texto="") Then
Texto=MsgOCRNaoFoiPossivelLer & CRLF
End If
'
Texto=AFFuncoes.Left(Texto,Texto.Length-1)
OCRTextoEscaneado.Text=Texto
'
Altura=StringUtilities.MeasureMultilineTextHeight(QRCodeTextoEscaneado,Texto)
OCRTextoEscaneado.Height=Altura
OCRScroll.Panel.Height=Altura
End Sub