📄 frmhandwriting.vb
字号:
Imports BrainNet.NeuralFramework
Public Class frmHandWriting
Inherits System.Windows.Forms.Form
Dim bmap As New Bitmap(100, 100)
Dim myBnn As NeuralNetwork
Dim ifMoving As Boolean = False
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents picMain As System.Windows.Forms.PictureBox
Friend WithEvents txtTrain As System.Windows.Forms.TextBox
Friend WithEvents btnTrain As System.Windows.Forms.Button
Friend WithEvents lblTrain As System.Windows.Forms.Label
Friend WithEvents lblDetect As System.Windows.Forms.Label
Friend WithEvents cmdDetect As System.Windows.Forms.Button
Friend WithEvents txtDetect As System.Windows.Forms.TextBox
Friend WithEvents gbMain As System.Windows.Forms.GroupBox
Friend WithEvents cmdClose As System.Windows.Forms.Button
Friend WithEvents cmdClear As System.Windows.Forms.Button
Friend WithEvents tbMain As System.Windows.Forms.TabControl
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
Friend WithEvents tbPage2 As System.Windows.Forms.TabPage
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents txtPattern As System.Windows.Forms.TextBox
Friend WithEvents lvReport As System.Windows.Forms.ListView
Friend WithEvents txtOutput As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.picMain = New System.Windows.Forms.PictureBox()
Me.txtTrain = New System.Windows.Forms.TextBox()
Me.btnTrain = New System.Windows.Forms.Button()
Me.lblTrain = New System.Windows.Forms.Label()
Me.lblDetect = New System.Windows.Forms.Label()
Me.cmdDetect = New System.Windows.Forms.Button()
Me.txtDetect = New System.Windows.Forms.TextBox()
Me.gbMain = New System.Windows.Forms.GroupBox()
Me.tbMain = New System.Windows.Forms.TabControl()
Me.TabPage1 = New System.Windows.Forms.TabPage()
Me.Label2 = New System.Windows.Forms.Label()
Me.tbPage2 = New System.Windows.Forms.TabPage()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.cmdClear = New System.Windows.Forms.Button()
Me.cmdClose = New System.Windows.Forms.Button()
Me.txtPattern = New System.Windows.Forms.TextBox()
Me.lvReport = New System.Windows.Forms.ListView()
Me.txtOutput = New System.Windows.Forms.TextBox()
Me.gbMain.SuspendLayout()
Me.tbMain.SuspendLayout()
Me.TabPage1.SuspendLayout()
Me.tbPage2.SuspendLayout()
Me.SuspendLayout()
'
'picMain
'
Me.picMain.BackColor = System.Drawing.Color.White
Me.picMain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.picMain.Location = New System.Drawing.Point(16, 56)
Me.picMain.Name = "picMain"
Me.picMain.Size = New System.Drawing.Size(99, 99)
Me.picMain.TabIndex = 0
Me.picMain.TabStop = False
'
'txtTrain
'
Me.txtTrain.Location = New System.Drawing.Point(80, 120)
Me.txtTrain.Name = "txtTrain"
Me.txtTrain.Size = New System.Drawing.Size(64, 20)
Me.txtTrain.TabIndex = 1
Me.txtTrain.Text = ""
'
'btnTrain
'
Me.btnTrain.Location = New System.Drawing.Point(80, 152)
Me.btnTrain.Name = "btnTrain"
Me.btnTrain.Size = New System.Drawing.Size(64, 24)
Me.btnTrain.TabIndex = 2
Me.btnTrain.Text = "Train"
'
'lblTrain
'
Me.lblTrain.Location = New System.Drawing.Point(8, 16)
Me.lblTrain.Name = "lblTrain"
Me.lblTrain.Size = New System.Drawing.Size(136, 88)
Me.lblTrain.TabIndex = 3
Me.lblTrain.Text = "To Train the network, draw the letter in the 'Pattern' box using your mouse. Then" & _
" enter the character you drawn in the below text box, and click 'Train' button"
'
'lblDetect
'
Me.lblDetect.Location = New System.Drawing.Point(8, 16)
Me.lblDetect.Name = "lblDetect"
Me.lblDetect.Size = New System.Drawing.Size(128, 80)
Me.lblDetect.TabIndex = 6
Me.lblDetect.Text = "To Run the network, draw a pattern on the Pattern picture box, and click Detect"
'
'cmdDetect
'
Me.cmdDetect.Location = New System.Drawing.Point(80, 152)
Me.cmdDetect.Name = "cmdDetect"
Me.cmdDetect.Size = New System.Drawing.Size(56, 24)
Me.cmdDetect.TabIndex = 5
Me.cmdDetect.Text = "Detect"
'
'txtDetect
'
Me.txtDetect.Location = New System.Drawing.Point(80, 120)
Me.txtDetect.Name = "txtDetect"
Me.txtDetect.Size = New System.Drawing.Size(56, 20)
Me.txtDetect.TabIndex = 4
Me.txtDetect.Text = ""
'
'gbMain
'
Me.gbMain.Controls.AddRange(New System.Windows.Forms.Control() {Me.tbMain, Me.picMain, Me.Label1, Me.cmdClear})
Me.gbMain.Location = New System.Drawing.Point(8, 8)
Me.gbMain.Name = "gbMain"
Me.gbMain.Size = New System.Drawing.Size(320, 248)
Me.gbMain.TabIndex = 7
Me.gbMain.TabStop = False
'
'tbMain
'
Me.tbMain.Controls.AddRange(New System.Windows.Forms.Control() {Me.TabPage1, Me.tbPage2})
Me.tbMain.Location = New System.Drawing.Point(136, 16)
Me.tbMain.Name = "tbMain"
Me.tbMain.SelectedIndex = 0
Me.tbMain.Size = New System.Drawing.Size(168, 216)
Me.tbMain.TabIndex = 7
'
'TabPage1
'
Me.TabPage1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.txtTrain, Me.lblTrain, Me.btnTrain})
Me.TabPage1.Location = New System.Drawing.Point(4, 22)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Size = New System.Drawing.Size(160, 190)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "Train"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(8, 120)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(64, 16)
Me.Label2.TabIndex = 5
Me.Label2.Text = "Character"
'
'tbPage2
'
Me.tbPage2.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label3, Me.lblDetect, Me.txtDetect, Me.cmdDetect})
Me.tbPage2.Location = New System.Drawing.Point(4, 22)
Me.tbPage2.Name = "tbPage2"
Me.tbPage2.Size = New System.Drawing.Size(160, 190)
Me.tbPage2.TabIndex = 1
Me.tbPage2.Text = "Run"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 120)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(64, 29)
Me.Label3.TabIndex = 7
Me.Label3.Text = "Detected Value"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(64, 16)
Me.Label1.TabIndex = 4
Me.Label1.Text = "Pattern :"
'
'cmdClear
'
Me.cmdClear.Location = New System.Drawing.Point(16, 200)
Me.cmdClear.Name = "cmdClear"
Me.cmdClear.Size = New System.Drawing.Size(96, 24)
Me.cmdClear.TabIndex = 9
Me.cmdClear.Text = "Clear"
'
'cmdClose
'
Me.cmdClose.Location = New System.Drawing.Point(664, 272)
Me.cmdClose.Name = "cmdClose"
Me.cmdClose.Size = New System.Drawing.Size(96, 24)
Me.cmdClose.TabIndex = 8
Me.cmdClose.Text = "Close"
'
'txtPattern
'
Me.txtPattern.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtPattern.ForeColor = System.Drawing.Color.Red
Me.txtPattern.Location = New System.Drawing.Point(8, 264)
Me.txtPattern.Multiline = True
Me.txtPattern.Name = "txtPattern"
Me.txtPattern.Size = New System.Drawing.Size(312, 232)
Me.txtPattern.TabIndex = 9
Me.txtPattern.Text = ""
'
'lvReport
'
Me.lvReport.Location = New System.Drawing.Point(336, 16)
Me.lvReport.Name = "lvReport"
Me.lvReport.Size = New System.Drawing.Size(416, 240)
Me.lvReport.TabIndex = 10
'
'txtOutput
'
Me.txtOutput.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtOutput.ForeColor = System.Drawing.Color.Red
Me.txtOutput.Location = New System.Drawing.Point(336, 264)
Me.txtOutput.Multiline = True
Me.txtOutput.Name = "txtOutput"
Me.txtOutput.Size = New System.Drawing.Size(312, 232)
Me.txtOutput.TabIndex = 11
Me.txtOutput.Text = ""
'
'frmHandWriting
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(770, 536)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtOutput, Me.lvReport, Me.txtPattern, Me.cmdClose, Me.gbMain})
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "frmHandWriting"
Me.Text = "HandWriting Recognition"
Me.gbMain.ResumeLayout(False)
Me.tbMain.ResumeLayout(False)
Me.TabPage1.ResumeLayout(False)
Me.tbPage2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub frmHandWriting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myBnn = New NeuralNetwork()
myBnn.AddInputLayer(100)
myBnn.AddHiddenLayer(100)
myBnn.AddOutputLayer(8)
myBnn.ConnectLayers()
End Sub
Private Sub picMain_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picMain.Click
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -