⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.vb

📁 neural networks applications
💻 VB
📖 第 1 页 / 共 3 页
字号:
        '
        'TabPage1
        '
        Me.TabPage1.BackColor = System.Drawing.Color.White
        Me.TabPage1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.TabPage1.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox4, Me.GroupBox3})
        Me.TabPage1.Location = New System.Drawing.Point(4, 25)
        Me.TabPage1.Name = "TabPage1"
        Me.TabPage1.Size = New System.Drawing.Size(539, 349)
        Me.TabPage1.TabIndex = 1
        Me.TabPage1.Text = "Detect Using Network"
        '
        'GroupBox4
        '
        Me.GroupBox4.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label4, Me.txtPatternDetect, Me.Label5, Me.txtAsciiDetect})
        Me.GroupBox4.Location = New System.Drawing.Point(6, 119)
        Me.GroupBox4.Name = "GroupBox4"
        Me.GroupBox4.Size = New System.Drawing.Size(518, 213)
        Me.GroupBox4.TabIndex = 21
        Me.GroupBox4.TabStop = False
        Me.GroupBox4.Text = "Results"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(16, 43)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(157, 20)
        Me.Label4.TabIndex = 15
        Me.Label4.Text = "Detected ASCII Character"
        '
        'txtPatternDetect
        '
        Me.txtPatternDetect.Location = New System.Drawing.Point(234, 83)
        Me.txtPatternDetect.Name = "txtPatternDetect"
        Me.txtPatternDetect.ReadOnly = True
        Me.txtPatternDetect.Size = New System.Drawing.Size(162, 20)
        Me.txtPatternDetect.TabIndex = 19
        Me.txtPatternDetect.Text = ""
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(233, 43)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(157, 20)
        Me.Label5.TabIndex = 18
        Me.Label5.Text = "Equivalent Pattern"
        '
        'txtAsciiDetect
        '
        Me.txtAsciiDetect.Location = New System.Drawing.Point(18, 83)
        Me.txtAsciiDetect.Name = "txtAsciiDetect"
        Me.txtAsciiDetect.ReadOnly = True
        Me.txtAsciiDetect.Size = New System.Drawing.Size(127, 20)
        Me.txtAsciiDetect.TabIndex = 16
        Me.txtAsciiDetect.Text = ""
        '
        'GroupBox3
        '
        Me.GroupBox3.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label3, Me.picImgDetect, Me.cmdDetect, Me.cmdBrowseDetect})
        Me.GroupBox3.Location = New System.Drawing.Point(7, 9)
        Me.GroupBox3.Name = "GroupBox3"
        Me.GroupBox3.Size = New System.Drawing.Size(514, 102)
        Me.GroupBox3.TabIndex = 20
        Me.GroupBox3.TabStop = False
        Me.GroupBox3.Text = "Detect Pattern"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(12, 34)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(151, 22)
        Me.Label3.TabIndex = 11
        Me.Label3.Text = "Image Or Pattern To Detect"
        '
        'picImgDetect
        '
        Me.picImgDetect.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.picImgDetect.Location = New System.Drawing.Point(17, 66)
        Me.picImgDetect.Name = "picImgDetect"
        Me.picImgDetect.Size = New System.Drawing.Size(20, 20)
        Me.picImgDetect.TabIndex = 14
        Me.picImgDetect.TabStop = False
        '
        'cmdDetect
        '
        Me.cmdDetect.BackColor = System.Drawing.SystemColors.Control
        Me.cmdDetect.Location = New System.Drawing.Point(318, 59)
        Me.cmdDetect.Name = "cmdDetect"
        Me.cmdDetect.Size = New System.Drawing.Size(160, 25)
        Me.cmdDetect.TabIndex = 17
        Me.cmdDetect.Text = "Detect This Image Now"
        '
        'cmdBrowseDetect
        '
        Me.cmdBrowseDetect.BackColor = System.Drawing.SystemColors.Control
        Me.cmdBrowseDetect.Location = New System.Drawing.Point(74, 61)
        Me.cmdBrowseDetect.Name = "cmdBrowseDetect"
        Me.cmdBrowseDetect.Size = New System.Drawing.Size(96, 24)
        Me.cmdBrowseDetect.TabIndex = 13
        Me.cmdBrowseDetect.Text = "Browse"
        '
        'pbTrain
        '
        Me.pbTrain.Location = New System.Drawing.Point(16, 201)
        Me.pbTrain.Name = "pbTrain"
        Me.pbTrain.Size = New System.Drawing.Size(509, 20)
        Me.pbTrain.TabIndex = 13
        '
        'cmdLoad
        '
        Me.cmdLoad.Image = CType(resources.GetObject("cmdLoad.Image"), System.Drawing.Bitmap)
        Me.cmdLoad.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.cmdLoad.Location = New System.Drawing.Point(286, 7)
        Me.cmdLoad.Name = "cmdLoad"
        Me.cmdLoad.Size = New System.Drawing.Size(122, 32)
        Me.cmdLoad.TabIndex = 11
        Me.cmdLoad.Text = "Load Network"
        '
        'cmdSave
        '
        Me.cmdSave.Image = CType(resources.GetObject("cmdSave.Image"), System.Drawing.Bitmap)
        Me.cmdSave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.cmdSave.Location = New System.Drawing.Point(149, 7)
        Me.cmdSave.Name = "cmdSave"
        Me.cmdSave.Size = New System.Drawing.Size(122, 32)
        Me.cmdSave.TabIndex = 10
        Me.cmdSave.Text = "Save Network"
        '
        'cmdExit
        '
        Me.cmdExit.Image = CType(resources.GetObject("cmdExit.Image"), System.Drawing.Bitmap)
        Me.cmdExit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.cmdExit.Location = New System.Drawing.Point(423, 7)
        Me.cmdExit.Name = "cmdExit"
        Me.cmdExit.Size = New System.Drawing.Size(123, 32)
        Me.cmdExit.TabIndex = 12
        Me.cmdExit.Text = "Exit Program"
        '
        'cmdRestart
        '
        Me.cmdRestart.Image = CType(resources.GetObject("cmdRestart.Image"), System.Drawing.Bitmap)
        Me.cmdRestart.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.cmdRestart.Location = New System.Drawing.Point(5, 7)
        Me.cmdRestart.Name = "cmdRestart"
        Me.cmdRestart.Size = New System.Drawing.Size(124, 32)
        Me.cmdRestart.TabIndex = 13
        Me.cmdRestart.Text = "New Network"
        '
        'pnTrain
        '
        Me.pnTrain.BackColor = System.Drawing.SystemColors.Control
        Me.pnTrain.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblTrainStart, Me.cmdCancel, Me.lblTrainInfo, Me.lblTrain, Me.pbTrain})
        Me.pnTrain.Location = New System.Drawing.Point(9, 60)
        Me.pnTrain.Name = "pnTrain"
        Me.pnTrain.Size = New System.Drawing.Size(553, 379)
        Me.pnTrain.TabIndex = 14
        '
        'lblTrainStart
        '
        Me.lblTrainStart.Location = New System.Drawing.Point(22, 249)
        Me.lblTrainStart.Name = "lblTrainStart"
        Me.lblTrainStart.Size = New System.Drawing.Size(252, 22)
        Me.lblTrainStart.TabIndex = 17
        '
        'cmdCancel
        '
        Me.cmdCancel.Location = New System.Drawing.Point(413, 232)
        Me.cmdCancel.Name = "cmdCancel"
        Me.cmdCancel.Size = New System.Drawing.Size(110, 24)
        Me.cmdCancel.TabIndex = 16
        Me.cmdCancel.Text = "Cancel"
        '
        'lblTrainInfo
        '
        Me.lblTrainInfo.Location = New System.Drawing.Point(22, 284)
        Me.lblTrainInfo.Name = "lblTrainInfo"
        Me.lblTrainInfo.Size = New System.Drawing.Size(252, 14)
        Me.lblTrainInfo.TabIndex = 15
        '
        'lblTrain
        '
        Me.lblTrain.Location = New System.Drawing.Point(14, 163)
        Me.lblTrain.Name = "lblTrain"
        Me.lblTrain.Size = New System.Drawing.Size(252, 24)
        Me.lblTrain.TabIndex = 14
        Me.lblTrain.Text = "Training Progress"
        '
        'pnNetwork
        '
        Me.pnNetwork.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdRestart, Me.cmdSave, Me.cmdLoad, Me.cmdExit})
        Me.pnNetwork.Location = New System.Drawing.Point(10, 4)
        Me.pnNetwork.Name = "pnNetwork"
        Me.pnNetwork.Size = New System.Drawing.Size(550, 50)
        Me.pnNetwork.TabIndex = 15
        '
        'frmMain
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(568, 450)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.tbMain, Me.pnTrain, Me.pnNetwork})
        Me.MaximizeBox = False
        Me.Name = "frmMain"
        Me.Text = "Pattern Detection"
        Me.tbMain.ResumeLayout(False)
        Me.tabTraining.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupBox1.ResumeLayout(False)
        Me.TabPage1.ResumeLayout(False)
        Me.GroupBox4.ResumeLayout(False)
        Me.GroupBox3.ResumeLayout(False)
        Me.pnTrain.ResumeLayout(False)
        Me.pnNetwork.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region


#Region "Event Handlers"

    '<summary> Load an image </summary>
    Private Sub cmdBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBrowse.Click
        Dim dlg As New OpenFileDialog()
        dlg.ShowDialog()

        If dlg.FileName = "" Then Exit Sub

        Try
            picImgTrain.Image = Image.FromFile(dlg.FileName)
        Catch ex As Exception
            MsgBox("Error: Invalid Image? " & ex.Message)
        End Try

    End Sub

    '<summary> Add to the list box </summary>
    Private Sub cmdAddToQueue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddToQueue.Click
        Try
            'We need the user to enter a proper image and corresponding ascii value
            If Len(Me.txtAsciiValue.Text) <> 1 Then Throw New Exception()

            imlMain.Images.Add(picImgTrain.Image)
            Me.lvMain.Items.Add(Me.txtAsciiValue.Text, imlMain.Images.Count - 1)
        Catch ex As Exception
            MsgBox("Error: Invalid image or ascii value")
        End Try

    End Sub

    '<summary> Clear all entries </summary>
    Private Sub cmdClearAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClearAll.Click

        lvMain.Items.Clear()
        imlMain.Images.Clear()

    End Sub


    '<summary> Call back to show the progress bar, used from
    'the TrainPattern function </summary>
    Sub ShowProgress(ByVal CurrentRound As Long, ByVal MaxRound As Long, ByRef cancel As Boolean)

        Me.pbTrain.Maximum = MaxRound
        Me.pbTrain.Value = CurrentRound

        'Check whether our used clicked the cancel button
        If Me.StopTraining = True Then cancel = True
        lblTrainInfo.Text = CurrentRound & " rounds finished of " & MaxRound & " times"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -