VB程序学习代码记录20160805

重做网格

Private Sub Command1_Click()
    Form1.Refresh
    Dim w, h As Integer
    Dim x, y As Integer
    Dim i As Integer
    w = Form1.ScaleWidth
    h = Form1.ScaleHeight
    x = Int(w / Val(Combo1.Text))
    y = Int(h / Val(Combo2.Text))
    For i = 1 To Combo1.Text + 1
        Line (x * i, 0)-(x * i, h)
    Next
    For i = 1 To Combo2.Text + 1
        Line (0, y * i)-(w, y * i)
    Next
End Sub
Private Sub Form_Load()
    Dim i As Integer
    For i = 1 To 500
        Combo1.AddItem (i)
        Combo2.AddItem (i)
    Next
End Sub

播放音乐

Private Sub Form_Load()
    With MMControl1
        .Visible = False
        .FileName = "C:\Users\Qi\Desktop\01.mp3"
        .Command = "open"
        .Command = "play"
    End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Form1.MMControl1.Command = "close"
End Sub

MMcontrol控件

Private Sub Form_Load()
    With MMControl1
        .FileName = "C:\Users\Qi\Desktop\仙境传说.mp3"
        .Command = "open"
        .Command = "play"
    End With
    If Form1.MMControl1.Error Then
        MsgBox Form1.MMControl1.ErrorMessage, vbCritical, "未安装CD播放器或CD播放器不能正常工作"
    End If
End Sub
Private Sub MMControl1_Done(NotifyCode As Integer)
    Select Case MMControl1.Mode
    Case 524
        Label1.Caption = "设备没有打开"
    Case 525
        Label1.Caption = "停止"
    Case 526
        Label1.Caption = "正在播放"
    Case 527
        Label1.Caption = "正在录制"
    Case 528
        Label1.Caption = "正在搜索"
    Case 529
        Label1.Caption = "暂停"
    Case 530
        Label1.Caption = "设备准备好"
    End Select
End Sub
Private Sub form_unload(cancel As Integer)
    Form1.MMControl1.Command = "close"
End Sub
Private Sub MMControl1_StatusUpdate()
    Label2.Caption = "当前曲目: " & Str$(MMControl1.Track)
End Sub
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值