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

📄 form1.frm

📁 模拟超市结帐报价、结帐的实时 报数和给用户的找零
💻 FRM
字号:
VERSION 5.00
Object = "{C1A8AF28-1257-101B-8FB0-0020AF039CA3}#1.1#0"; "MCI32.OCX"
Begin VB.Form Form1 
   Caption         =   "数字报数"
   ClientHeight    =   1995
   ClientLeft      =   5820
   ClientTop       =   2625
   ClientWidth     =   5385
   LinkTopic       =   "Form1"
   ScaleHeight     =   1995
   ScaleWidth      =   5385
   Begin VB.CommandButton Command2 
      Caption         =   "<-----报数"
      Height          =   375
      Left            =   3120
      TabIndex        =   3
      Top             =   960
      Width           =   1935
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Text            =   "141.25"
      Top             =   960
      Width           =   2415
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1920
      TabIndex        =   1
      Top             =   240
      Width           =   3135
   End
   Begin MCI.MMControl MMControl1 
      Height          =   495
      Left            =   120
      TabIndex        =   0
      Top             =   1440
      Visible         =   0   'False
      Width           =   3540
      _ExtentX        =   6244
      _ExtentY        =   873
      _Version        =   393216
      DeviceType      =   ""
      FileName        =   ""
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "请输入阿拉伯数字:"
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   240
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'**********************
'经常来枕善居下载源码
'没传过什么源码
'这个是数字报数源码,还不大完善
'请大家帮忙完善吧,做好写成函数,方便调用。
'*********************
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)





Private Sub Command2_Click()
 a = Split(Text2.Text, ".")
 y = a(0) & a(1)
 If Len(y) = 5 Then
    For i = 1 To 5
        baosu (Mid(y, i, 1))
        x = (Mid(y, i, 1))
        Sleep (500)
        If i = 1 Then
              MMControl1.From = 4215:
              MMControl1.To = 4543
              MMControl1.Command = "play"  '播放佰
        ElseIf i = 2 Then
             If x <> 0 Then '第i个数不为0
              MMControl1.From = 4543:
              MMControl1.To = 5148
              MMControl1.Command = "play"  '播放拾
              End If
        ElseIf i = 3 Then
              MMControl1.From = 5148:
              MMControl1.To = 5611
              MMControl1.Command = "play"  '播放元
        ElseIf i = 4 Then
              If x <> 0 Then '第i个数不为0
              MMControl1.From = 5611:
              MMControl1.To = 5948
              MMControl1.Command = "play"  '播放角
              End If
        ElseIf i = 5 Then
              MMControl1.From = 5948:
              MMControl1.To = 6444
              MMControl1.Command = "play"  '播放分
        End If
        Sleep (500)
    Next
 End If
End Sub

Private Sub Form_Load()
MMControl1.TimeFormat = 0

MMControl1.DeviceType = "waveaudio"

MMControl1.FileName = App.Path & "\sound.wav"

MMControl1.Command = "open"

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = Asc("1") Then
   MMControl1.From = 0:
   MMControl1.To = 429
   MMControl1.Command = "play"  '播放1
ElseIf KeyAscii = Asc("2") Then
   MMControl1.From = 429:
   MMControl1.To = 765
   MMControl1.Command = "play"  '播放2
ElseIf KeyAscii = Asc("3") Then
   MMControl1.From = 765:
   MMControl1.To = 1312
   MMControl1.Command = "play"  '播放3
ElseIf KeyAscii = Asc("4") Then
   MMControl1.From = 1312:
   MMControl1.To = 1775
   MMControl1.Command = "play"  '播放4
ElseIf KeyAscii = Asc("5") Then
   MMControl1.From = 1775:
   MMControl1.To = 2195
   MMControl1.Command = "play"  '播放5
ElseIf KeyAscii = Asc("6") Then
   MMControl1.From = 2195:
   MMControl1.To = 2591
   MMControl1.Command = "play"  '播放6
ElseIf KeyAscii = Asc("7") Then
   MMControl1.From = 2591:
   MMControl1.To = 3011
   MMControl1.Command = "play"  '播放7
ElseIf KeyAscii = Asc("8") Then
   MMControl1.From = 3011:
   MMControl1.To = 3424
   MMControl1.Command = "play"  '播放8
ElseIf KeyAscii = Asc("9") Then
   MMControl1.From = 3424:
   MMControl1.To = 3777
   MMControl1.Command = "play"  '播放9
ElseIf KeyAscii = Asc("0") Then
   MMControl1.From = 3777:
   MMControl1.To = 4215
   MMControl1.Command = "play"  '播放0
End If

End Sub


Private Sub baosu(num As String)
    Select Case num
           Case 1
                MMControl1.From = 0:
                MMControl1.To = 429
                MMControl1.Command = "play"  '播放1
           Case 2
                MMControl1.From = 429:
                MMControl1.To = 765
                MMControl1.Command = "play"  '播放2
           Case 3
                MMControl1.From = 765:
                MMControl1.To = 1312
                MMControl1.Command = "play"  '播放3
           Case 4
                MMControl1.From = 1312:
                MMControl1.To = 1775
                MMControl1.Command = "play"  '播放4
           Case 5
                MMControl1.From = 1775:
                MMControl1.To = 2195
                MMControl1.Command = "play"  '播放5
           Case 6
                MMControl1.From = 2195:
                MMControl1.To = 2591
                MMControl1.Command = "play"  '播放6
           Case 7
                MMControl1.From = 2591:
                MMControl1.To = 3011
                MMControl1.Command = "play"  '播放7
           Case 8
                MMControl1.From = 3011:
                MMControl1.To = 3424
                MMControl1.Command = "play"  '播放8
           Case 9
                MMControl1.From = 3424:
                MMControl1.To = 3777
                MMControl1.Command = "play"  '播放9
           Case 0
                MMControl1.From = 3777:
                MMControl1.To = 4215
                MMControl1.Command = "play"  '播放0
    End Select
             
             
End Sub

⌨️ 快捷键说明

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