我用两个label来显示MP3的进度条,要怎么实现拖拉的过程?

vbfdy 2004-03-19 05:06:35
我用两个label来显示MP3的进度条,要怎么实现拖拉的过程?和怎样让MP3同时能一起改变播放进度?

大家把源代码打出来好吗?谢谢
...全文
61 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
vbfdy 2004-03-19
  • 打赏
  • 举报
回复
哦,谢谢楼上的,希望可以更全一点。我是刚学VB的,很多都不懂,谢谢
hhyttppd 2004-03-19
  • 打赏
  • 举报
回复
Dim maxI As Integer, minI As Integer
Dim stepI As Integer
Dim i As Integer
Dim currentI As Integer

Private Sub Form_Click()
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
currentI = 0
i = 0
maxI = 4000
stepI = 100
Label1.Width = 0
Label1.BackColor = vbGreen
End Sub


Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Label1.Width = X
End If
End Sub

Private Sub Timer1_Timer()
If maxI <= Label1.Width Then Exit Sub
Label1.Width = Label1.Width + stepI * i
i = i + 1
End Sub
踏平扶桑 2004-03-19
  • 打赏
  • 举报
回复
'用一个label何一个shape实现的.label的长度为4000便于计算,由于时间关系有些变量何api的声明我就不写了,可能会有报错,还望楼主自己解决:)
Private Sub Label8_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
lenght = Shape1.Width'lenght是个定义好的变量
If Button = vbLeftButton Then
If playing Or rmplaying Then
If X > 0 And X < 4000 Then
Dim lnglength As Long
Shape1.Width = X
Dim cmtmp As String '命令临时变量
lnglength = (Shape1.Width / 4000) * length
cmtmp = "seek " & "mp3 " & "to " & lnglength '查找到指定得位置
mciSendString cmtmp, vbNull, 0, 0
mciSendString "play mp3", vbNull, 0, 0
End If
lnglength = 0
End If
End If
End Sub
dragon525 2004-03-19
  • 打赏
  • 举报
回复
开 一 个 工 程, 在Form1 上 放 一 个Label控 件, 命 名 为lbl。 然 后 紧 靠lbl的 右 侧 放 一 个 高 度 与lbl相 同 但 宽 度 尽 量 小 的PictureBox 控 件(作为拖动杆), 命 名 为Pic,宽 度 要 小 到 看 不 见 立 体 效 果。 将Picture1 的MousePointer 属 性 设 置 成9 (vbSizeWE) 。

Pic的MouseMove 事 件 如 下:

Private Sub Pic_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Pic.Left = Pic.Left + X
lbl.Width = Pic.Left - lbl.Left
End If
End Sub

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧