📄 wordreading.frm
字号:
VERSION 5.00
Begin VB.Form frmMain
Caption = "天天背单词"
ClientHeight = 465
ClientLeft = 165
ClientTop = 555
ClientWidth = 8430
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 465
ScaleWidth = 8430
StartUpPosition = 3 '窗口缺省
Tag = "1"
Begin VB.Data Data2
Caption = "Data2"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 4440
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 120
Visible = 0 'False
Width = 1140
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\deskpet\wordreading\wordlib.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 5160
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "words"
Top = 120
Visible = 0 'False
Width = 1140
End
Begin VB.Timer Timer1
Left = 6480
Top = 0
End
Begin VB.CommandButton cmdPlay
Caption = "◣"
Enabled = 0 'False
Height = 375
Left = 7440
TabIndex = 4
ToolTipText = "播放"
Top = 0
Width = 375
End
Begin VB.CommandButton cmdStop
Caption = "■"
Height = 375
Left = 7920
TabIndex = 3
ToolTipText = "停止"
Top = 0
Width = 375
End
Begin VB.Label lblInterpret
Height = 375
Left = 3240
TabIndex = 2
Top = 120
Width = 3855
End
Begin VB.Label lblProperty
Height = 375
Left = 2160
TabIndex = 1
Top = 120
Width = 975
End
Begin VB.Label lblSpell
Height = 375
Left = 0
TabIndex = 0
Top = 120
Width = 2055
End
Begin VB.Menu mcontrol
Caption = "控制"
Visible = 0 'False
Begin VB.Menu settings
Caption = "设置"
End
Begin VB.Menu sstop
Caption = "停止"
End
Begin VB.Menu sstart
Caption = "开始"
End
Begin VB.Menu addwords
Caption = "添加单词库"
End
Begin VB.Menu addremmber
Caption = "添加为备忘"
End
Begin VB.Menu editLib
Caption = "编辑单词库"
End
Begin VB.Menu exit
Caption = "退出->"
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub addremmber_Click()
Dim cRs As curRs
Dim stw As Byte, stpw As Byte
stw = CInt(Asc(Trim(CONFSTR.wordstart))): stpw = CInt(Asc(Trim(CONFSTR.wordstop)))
Dim src As String, db As String
db = Trim(CONFSTR.initlib)
src = "SELECT * FROM " & db & " WHERE topasc >= " & stw & " AND topasc <= " & stpw & " ORDER BY topasc ASC"
Call cmdStop_Click
On Error Resume Next
With Data1
.Recordset.MovePrevious
If .Recordset.BOF Then .Recordset.MoveFirst
cRs.id = .Recordset("id")
cRs.spell = .Recordset("spell")
cRs.property = .Recordset("property")
cRs.interpret = .Recordset("interpret")
cRs.topasc = .Recordset("topasc")
End With
With Data2
.DatabaseName = ROOT & "/wordlib.mdb"
.RecordSource = "specialWords"
.Refresh
.Recordset.AddNew
.Recordset("id") = cRs.id
.Recordset("spell") = Trim(cRs.spell)
.Recordset("property") = Trim(cRs.property)
.Recordset("interpret") = Trim(cRs.interpret)
.Recordset("topasc") = cRs.topasc
.Recordset.Update
.Recordset.Close
End With
If Err Then
MsgBox "单词: " & Trim(cRs.spell) & " 已存在!", vbExclamation, "信息"
Else
MsgBox "单词: " & Trim(cRs.spell) & " 已添加!", vbInformation, "信息"
End If
Call cmdPlay_Click
End Sub
Private Sub editLib_Click()
Call cmdStop_Click
frmEditWords.Show 1
End Sub
Private Sub exit_Click()
Data1.Recordset.Close
End
End Sub
Private Sub Form_Load()
ROOT = App.Path
Me.Data1.DatabaseName = ROOT & "\wordlib.mdb"
Call loadConfig
Call initMainForm
Me.Top = 1000
Me.Left = (Screen.Width - Me.Width) - 1000
Me.Timer1.Enabled = True
Me.cmdPlay.Enabled = False
Me.cmdStop.Enabled = True
addremmber.Enabled = False
sstart.Enabled = False
Call checkWordsEmpty
End Sub
Private Sub checkWordsEmpty()
If Data1.Recordset.BOF Then
If Trim(CONFSTR.initlib) = "words" Then
MsgBox "请先录入单词到词库", vbInformation, "提示"
CONFSTR.initlib = "words"
addremmber.Enabled = False 'forbiden add remberList
Call addwords_Click
ElseIf Trim(CONFSTR.initlib) = "specialWords" Then
MsgBox "您的记忆库没有内容", vbInformation, "提示"
Call settings_Click
End If
End If
End Sub
Private Sub cmdPlay_Click()
Data1.Refresh
Timer1.Enabled = True
cmdPlay.Enabled = False
cmdStop.Enabled = True
sstart.Enabled = False
sstop.Enabled = True
addremmber.Enabled = False
End Sub
Private Sub cmdStop_Click()
Timer1.Enabled = False
cmdPlay.Enabled = True
cmdStop.Enabled = False
sstart.Enabled = True
sstop.Enabled = False
addremmber.Enabled = True
End Sub
Private Sub addwords_Click()
Call cmdStop_Click
CONFSTR.initlib = "words"
Timer1.Enabled = False
frmAddwords.Show 1
End Sub
Private Sub Form_MouseDown(Botton As Integer, Shift As Integer, X As Single, Y As Single)
If Botton = 2 Then
PopupMenu mcontrol, 4 Or 2
End If
End Sub
Private Sub settings_Click()
Call cmdStop_Click
frmSetting.Show 1
End Sub
Private Sub lblSpell_MouseDown(Botton As Integer, Shift As Integer, X As Single, Y As Single)
If Botton = 2 Then
PopupMenu mcontrol, 4 Or 2
End If
End Sub
Private Sub lblProperty_MouseDown(Botton As Integer, Shift As Integer, X As Single, Y As Single)
If Botton = 2 Then
PopupMenu mcontrol, 4 Or 2
End If
End Sub
Private Sub lblInterpret_MouseDown(Botton As Integer, Shift As Integer, X As Single, Y As Single)
If Botton = 2 Then
PopupMenu mcontrol, 4 Or 2
End If
End Sub
Private Sub sstart_Click()
Call cmdPlay_Click
End Sub
Private Sub sstop_Click()
Call cmdStop_Click
End Sub
Private Sub Timer1_Timer()
On Error GoTo check
With Data1
lblSpell.Caption = .Recordset("spell")
lblProperty.Caption = .Recordset("property")
lblInterpret.Caption = .Recordset("interpret")
.Recordset.MoveNext
If .Recordset.EOF Then
.Recordset.MoveFirst
End If
End With
check:
Call checkWordsEmpty
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -