Greetings all, this is my first post.
I am building a custom OCR program to grab data from the screen. I am a self taught programmer and have learned things as I needed them but I believe I'm struggling with properly using Object-Oriented principles in my code.
I have been able to build a solution using separate single column arrays to hold my data and they are linked by the index number but I keep thinking that if can get classes/structures nailed down, the code will be much neater.
Here's how I want my data to look.
Screen Number --> Has position properties and can contain multiple Tables
Table Number --> Has various properties and can contain multiple zones
Zone Number --> Has various properties
I have tried using structures and have some non-working code below that I think gives the sense of what I'm trying to do.
I want to be able to reference things like:
ScreenNo(1).XaxisPixelPosition = 1440
and
ScreenNo(1).TablesCount(1).CharHeight = 7
The data is basically properties that are constantly referred to that tell the OCR functions which pixels to grab. I need to be able to add new screens if necessary which will contain new tables and zones.
My knowledge of classes and structures is really weak. I would appreciate any pointers to tutorials but if you can see what I'm trying to do from my description here and can advise that would be great.
I am building a custom OCR program to grab data from the screen. I am a self taught programmer and have learned things as I needed them but I believe I'm struggling with properly using Object-Oriented principles in my code.
I have been able to build a solution using separate single column arrays to hold my data and they are linked by the index number but I keep thinking that if can get classes/structures nailed down, the code will be much neater.
Here's how I want my data to look.
Screen Number --> Has position properties and can contain multiple Tables
Table Number --> Has various properties and can contain multiple zones
Zone Number --> Has various properties
I have tried using structures and have some non-working code below that I think gives the sense of what I'm trying to do.
I want to be able to reference things like:
ScreenNo(1).XaxisPixelPosition = 1440
and
ScreenNo(1).TablesCount(1).CharHeight = 7
The data is basically properties that are constantly referred to that tell the OCR functions which pixels to grab. I need to be able to add new screens if necessary which will contain new tables and zones.
My knowledge of classes and structures is really weak. I would appreciate any pointers to tutorials but if you can see what I'm trying to do from my description here and can advise that would be great.
VB.NET:
Imports System
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ScreenNo() As New ScreenID
ScreenNo(1).TablesCount(1).CharHeight = 7
End Sub
Public Structure ScreenID
Public TablesCount() As TableID
Public PixX As Integer
Public PixY As Integer
End Structure
Public Structure TableID
Public ZonesCount() As ZoneID
Public PixX As Integer
Public PixY As Integer
Public CharHeight As Integer 'Width in pixels
Public CharWidth As Integer 'Width in pixels
Public RowHeight As Integer 'Height in pixels
Public RowCount As Integer
End Structure
Public Structure ZoneID
Public PixX As Integer
Public PixY As Integer
Public CharsCount As Integer 'Number of characters per row in zone (eg. time "12:34:01" has 8 chars)
End Structure
End Class