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

📄 frmmain.frm

📁 联机手写汉字识别
💻 FRM
📖 第 1 页 / 共 3 页
字号:
            Key             =   "Bold"
            Object.ToolTipText     =   "Bold"
            ImageKey        =   "Bold"
         EndProperty
         BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Italic"
            Object.ToolTipText     =   "Italic"
            ImageKey        =   "Italic"
         EndProperty
         BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Underline"
            Object.ToolTipText     =   "Underline"
            ImageKey        =   "Underline"
         EndProperty
         BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Align Left"
            Object.ToolTipText     =   "Align Left"
            ImageKey        =   "Align Left"
            Style           =   2
         EndProperty
         BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Center"
            Object.ToolTipText     =   "Center"
            ImageKey        =   "Center"
            Style           =   2
         EndProperty
         BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Align Right"
            Object.ToolTipText     =   "Align Right"
            ImageKey        =   "Align Right"
            Style           =   2
         EndProperty
         BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Delete"
            Object.ToolTipText     =   "Delete"
            ImageKey        =   "Delete"
         EndProperty
         BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Redo"
            Object.ToolTipText     =   "Redo"
            ImageKey        =   "Redo"
         EndProperty
         BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Undo"
            Object.ToolTipText     =   "Undo"
            ImageKey        =   "Undo"
         EndProperty
      EndProperty
   End
   Begin VB.Menu mnuFile 
      Caption         =   "文件(&F)"
      Begin VB.Menu mnuFileBar5 
         Caption         =   "-"
         Visible         =   0   'False
      End
      Begin VB.Menu mnuFileExit 
         Caption         =   "退出(&X)"
         Shortcut        =   ^X
      End
   End
   Begin VB.Menu mnuEdit 
      Caption         =   "编辑(&E)"
      Enabled         =   0   'False
   End
   Begin VB.Menu mnuView 
      Caption         =   "设置(&S)"
      Begin VB.Menu mnuViewToolbar 
         Caption         =   "工具栏(&T)"
         Checked         =   -1  'True
         Shortcut        =   ^T
      End
      Begin VB.Menu mnuViewStatusBar 
         Caption         =   "状态条(&B)"
         Checked         =   -1  'True
         Shortcut        =   ^B
      End
      Begin VB.Menu mnuViewOptions 
         Caption         =   "米字格"
         Checked         =   -1  'True
         Shortcut        =   ^M
      End
      Begin VB.Menu mnuViewBar0 
         Caption         =   "-"
      End
      Begin VB.Menu mnuViewRefresh 
         Caption         =   "识别类似度"
      End
      Begin VB.Menu mnuViewWebBrowser 
         Caption         =   "候选字门限值"
      End
   End
   Begin VB.Menu mnuTools 
      Caption         =   "工具(&T)"
      Begin VB.Menu mesgDebug 
         Caption         =   "识别信息(&D)"
         Shortcut        =   ^D
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "帮助(&H)"
      Begin VB.Menu mnuHelpAbout 
         Caption         =   "版本(&A) "
         Shortcut        =   ^A
      End
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)
Dim Pre_U As Integer, Pre_V As Integer
Dim Start_X As Integer, Start_Y As Integer, End_X As Integer, End_Y As Integer
Dim Flag As Boolean
Dim DrawNow As Boolean
Dim IsTrain As Boolean
Dim Bold_Flag As Boolean, Italic_Flag As Boolean, Underl_Flag As Boolean

Private Sub cmdCorrect_Click()
    If Flag_Recog = True Then
        Flag_Recog = False
        Picture1.Cls
        If optMiZiGe Then
            Call MiZiGe
        End If
        
        TextUnknown.Visible = False
        TextOut.Visible = True
        
        If IsTrain = True Then
            Call ExCharact
            fMainForm.cmdCorrect.Caption = "下一个"
            TextOut.SetFocus
        Else
            Call Hz_Recognize
            fMainForm.cmdCorrect.Caption = "修正"
        End If
        Call Init_Grid
        Key_A = 0:        Key_B = 0:        Key_C = ""
    Else
        TextUnknown.Visible = False
        TextOut.Visible = True
        TextOut.SetFocus
        TextOut.SelStart = 0
        TextOut.SelLength = Len(TextOut.Text)
    End If
End Sub

Private Sub cmdTrain_Click()
   If IsTrain = False Then
    Pic3_Width = Picture3.Width
    Pic3_Height = Picture3.Height
    Picture3.Visible = True
    
    TextUnknown.Visible = False
    TextOut.Visible = True
    TextOut.Text = ""
    TextOut.SetFocus
    Picture3.Cls
    IsTrain = True
    cmdTrain.Caption = "结束训练"
  Else
    Picture3.Visible = False
    Picture3.Cls
    IsTrain = False
    cmdTrain.Caption = "训练"
    cmdCorrect.Caption = "修正"

  End If
End Sub

Private Sub Concadidate_Click(Index As Integer)
    Text_Edit.Text = Text_Edit.Text & Concadidate(Index).Caption
    Text_Edit.SetFocus
    Text_Edit.SelStart = Len(Text_Edit)
    Text_Edit.SelLength = 0
    
    TextOut.Text = ""
    Call Init_ConcaDi
End Sub

Private Sub Form_Load()
    'Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
    'Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
    'Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500)
    'Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500)

    Me.Width = 0.75 * Screen.Width
    Me.Height = 0.75 * Screen.Height
    Me.Left = 0.5 * (Screen.Width - Me.Width)
    Me.Top = 0.5 * (Screen.Height - Me.Height)
    
    Picture1.Height = 0.65 * frmMain.ScaleHeight
    Picture1.Width = 0.65 * frmMain.ScaleWidth
    Picture1.Left = 0:    Picture1.Top = 450
    Call MiZiGe:            optMiZiGe = True
    
    Pic1_Width = Picture1.Width:    Pic1_Height = Picture1.Height
   
    Picture2.Height = 0.25 * frmMain.ScaleHeight
    Picture2.Width = 0.25 * frmMain.ScaleWidth
    Picture2.Left = 6300
    Picture2.Top = 450
    Pic2_Width = Picture2.Width:    Pic2_Height = Picture2.Height
    
    Resemble_Extent = 0.9
    Resemble_Limit = 0.8
    'Call Init_Grid
    Call Init_Col
    Flag = False
    DrawNow = True
    IsTrain = False
    Flag_Recog = False
    Key_A = 0:    Key_B = 0:    Key_C = ""
    Bold_Flag = True
    Italic_Flag = True
    Underl_Flag = True
    msgDebug = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Dim I As Integer

    'close all sub forms
    For I = Forms.Count - 1 To 1 Step -1
        Unload Forms(I)
    Next
    If Me.WindowState <> vbMinimized Then
        SaveSetting App.Title, "Settings", "MainLeft", Me.Left
        SaveSetting App.Title, "Settings", "MainTop", Me.Top
        SaveSetting App.Title, "Settings", "MainWidth", Me.Width
        SaveSetting App.Title, "Settings", "MainHeight", Me.Height
    End If
End Sub


Private Sub mesgDebug_Click()
    mesgDebug.Checked = Not mesgDebug.Checked
    msgDebug = Not msgDebug

End Sub

Private Sub Picture1_dblClick()
    If DrawNow = True Then
        Picture1.Visible = False:        Picture1.Cls
        Picture1.Height = 0.65 * frmMain.ScaleHeight
        Picture1.Width = 0.65 * frmMain.ScaleWidth
        Picture1.Left = 0:              Picture1.Top = 450
        Pic1_Height = 0.65 * frmMain.ScaleHeight
        Pic1_Width = 0.65 * frmMain.ScaleWidth
        Picture1.Visible = True
        
        If optMiZiGe Then
            Call MiZiGe
        End If
        DrawNow = False
'        IsTrain = False
        Key_A = 0:        Key_B = 0:        Key_C = ""
        Flag_Recog = False
        Call Init_Grid
        'Call Init_ConcaDi
    Else
        Picture1.Height = 0.25 * frmMain.Height
        Picture1.Width = 0.25 * frmMain.Width
        Picture1.Left = 0:        Picture1.Top = 450
        Picture1.Cls
        Pic1_Height = Picture1.Height:     Pic1_Width = Picture1.Width
        
        If optMiZiGe Then
            Call MiZiGe
        End If
        DrawNow = True
 '       IsTrain = False
        Key_A = 0:        Key_B = 0:        Key_C = ""
        Flag_Recog = False
        Call Init_Grid
        'Call Init_ConcaDi
    End If
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then
        Call Init_ConcaDi
        Flag = True
        If IsTrain Then
            cmdCorrect.Caption = "抽取特征"
        Else
            fMainForm.cmdCorrect.Caption = "识别"
        End If
        Flag_Recog = True
        Key_A = Key_A + 1
        
        Start_X = X:        Start_Y = Y
        
        Pre_U = X * GRID_NO \ Pic1_Width + 1
        Pre_V = Y * GRID_NO \ Pic1_Height + 1
Else
        Picture1.Cls
        If optMiZiGe Then
            Call MiZiGe
        End If
        
        TextUnknown.Visible = False
        TextOut.Visible = True
        Call Init_ConcaDi
        If IsTrain = True Then
            Call ExCharact
            fMainForm.cmdCorrect.Caption = "下一个"
            TextOut.SetFocus
        Else
            Call Hz_Recognize
            fMainForm.cmdCorrect.Caption = "修正"
        End If
        Call Init_Grid
        Key_A = 0:        Key_B = 0:        Key_C = ""
        Flag_Recog = False
End If
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   Dim U As Integer, V As Integer, S As Integer, T As Integer
   
   If Flag = True Then
        If X < Pic1_Width And X >= 0 And Y < Pic1_Height And Y >= 0 Then
            U = X * GRID_NO \ Pic1_Width + 1
            V = Y * GRID_NO \ Pic1_Height + 1
            If A(U, V) = 1 Then
                Key_B = Key_B + 1
            End If
            A(U, V) = 1
            ''If Abs(U - Pre_U) + Abs(V - Pre_V) <> 1 Then
            Call Grid_Line(Pre_U, Pre_V, U, V)  '补点
            ''End If
            Pre_U = U:            Pre_V = V
        End If
    
        S = U * Pic1_Width \ GRID_NO

⌨️ 快捷键说明

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