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

📄 form5.frm

📁 完整的英语900句源码-采用顶条技术
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form5 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "自助模式"
   ClientHeight    =   4725
   ClientLeft      =   4305
   ClientTop       =   2475
   ClientWidth     =   3765
   Icon            =   "Form5.frx":0000
   LinkTopic       =   "Form5"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4725
   ScaleWidth      =   3765
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame2 
      Caption         =   "用户语录"
      Enabled         =   0   'False
      Height          =   1260
      Left            =   75
      TabIndex        =   4
      Top             =   1050
      Width           =   3615
      Begin VB.CommandButton Command6 
         Caption         =   "整理"
         Enabled         =   0   'False
         Height          =   270
         Left            =   1255
         TabIndex        =   12
         Top             =   870
         Width           =   720
      End
      Begin VB.CommandButton Command5 
         Caption         =   "导入"
         Enabled         =   0   'False
         Height          =   270
         Left            =   2030
         TabIndex        =   11
         Top             =   870
         Width           =   720
      End
      Begin VB.CommandButton Command4 
         Caption         =   "导出"
         Enabled         =   0   'False
         Height          =   270
         Left            =   2805
         TabIndex        =   10
         Top             =   870
         Width           =   720
      End
      Begin VB.CommandButton Command3 
         Caption         =   "追加"
         Enabled         =   0   'False
         Height          =   270
         Left            =   480
         TabIndex        =   9
         Top             =   870
         Width           =   720
      End
      Begin VB.TextBox Text3 
         Enabled         =   0   'False
         Height          =   270
         Left            =   480
         TabIndex        =   6
         Top             =   555
         Width           =   3045
      End
      Begin VB.TextBox Text2 
         Enabled         =   0   'False
         Height          =   270
         Left            =   480
         TabIndex        =   5
         Top             =   240
         Width           =   3045
      End
      Begin VB.Label Label2 
         Caption         =   "译文"
         Enabled         =   0   'False
         Height          =   180
         Left            =   105
         TabIndex        =   8
         Top             =   585
         Width           =   360
      End
      Begin VB.Label Label1 
         Caption         =   "英文"
         Enabled         =   0   'False
         Height          =   180
         Left            =   105
         TabIndex        =   7
         Top             =   270
         Width           =   360
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "自由朗读"
      Height          =   570
      Left            =   75
      TabIndex        =   0
      Top             =   90
      Width           =   3615
      Begin VB.CommandButton Command2 
         Caption         =   "清"
         Height          =   270
         Left            =   3270
         TabIndex        =   3
         ToolTipText     =   "或按Del键"
         Top             =   195
         Width           =   270
      End
      Begin VB.CommandButton Command1 
         Caption         =   "读"
         Height          =   270
         Left            =   2970
         TabIndex        =   2
         ToolTipText     =   "或按Enter键"
         Top             =   195
         Width           =   270
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   75
         TabIndex        =   1
         Text            =   "请输入欲朗读的英文句子!"
         Top             =   195
         Width           =   2865
      End
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      Caption         =   "更多功能将在2.0版推出,敬请期待!"
      Enabled         =   0   'False
      Height          =   225
      Left            =   90
      TabIndex        =   13
      Top             =   795
      Width           =   3600
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim txtvoice As New VTxtAuto.VTxtAuto   '引用文本发音引擎


'朗读用户输入的内容
Private Sub Command1_Click()
     Call testtxt '对输入文本进行合法性检查
     If Text1.Text = "才不要念它呢,我会变哑巴的。:-)" Then GoTo mmm
     If Text1.Text <> "" Then
     txtvoice.Speed = sspeed
     On Error Resume Next '发音出错改向,由用户处理
     txtvoice.Speak Text1.Text, vtxtst_STATEMENT Or vtxtst_QUESTION Or vtxtst_NUMBERS
     End If
mmm: Text1.SetFocus
     If Err <> 0 Then Text1.Text = "请不要输入中文或怪异的表达!": Err.Number = 0
End Sub

'清除文本框中的内容
Private Sub Command2_Click()
     Text1.Text = ""
     Text1.SetFocus
End Sub

Private Sub Form_Load()
     '进入设置窗口时对发音引擎进行初始化
     Set txtvoice = Nothing
     txtvoice.Register vbNullString, " "
     
     Form1.Image1.Enabled = False '自助窗口出现时禁止菜单弹出
     Form1.Timer5.Enabled = False '自助时禁止朗读时序

End Sub

Private Sub Form_Unload(Cancel As Integer)
     Form1.Image1.Enabled = True '自助窗口退出时恢复菜单弹出
     Form1.Timer5.Enabled = True '完成自助,恢复朗读时序
     Set Form5 = Nothing
End Sub

'将输入内容用提示条显示完整
Private Sub Text1_Change()
     Text1.ToolTipText = Text1.Text
End Sub

'双击文本框清除内容
Private Sub Text1_DblClick()
     Text1.Text = ""
     Text1.SetFocus
End Sub

'按下回车键时朗读
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
     '如果文本框内有中文则敲任何键都先清空
     If Text1.Text = "请不要输入中文或怪异的表达!" Or Text1.Text = "才不要念它呢,我会变哑巴的。:-)" Or Text1.Text = "请输入欲朗读的英文句子!" Then Text1.Text = ""
     If KeyCode = vbKeyReturn Then
          Call testtxt '对输入文本进行合法性检查
          If Text1.Text = "才不要念它呢,我会变哑巴的。:-)" Then GoTo nnn
          If Text1.Text <> "" Then
          txtvoice.Speed = sspeed
          On Error Resume Next '发音出错改向,由用户处理
          txtvoice.Speak Text1.Text, vtxtst_STATEMENT Or vtxtst_QUESTION
          End If
nnn:      Text1.SetFocus
          If Err <> 0 Then Text1.Text = "请不要输入中文或怪异的表达!": Err.Number = 0
     '按DEL键清除文本内容
     ElseIf KeyCode = vbKeyDelete Then Text1.Text = "": Text1.SetFocus
     End If
End Sub

'对输入文本进行合法性检查子过程
Private Sub testtxt()
On Error Resume Next
If left(Text1.Text, 10) = String(10, left(Text1.Text, 1)) Then '如果连续10个相同字符则不念
Text1.Text = "才不要念它呢,我会变哑巴的。:-)"
If Err <> 0 Then Text1.Text = "请不要输入中文或怪异的表达!": Err.Number = 0
End If
End Sub

'避免按回车键时发出“嘀”声
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(vbCr) Then
KeyAscii = 0
End If
End Sub

⌨️ 快捷键说明

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