急求 vb高手解答,设计一个能控制速度的滚动字幕程序

2025-02-26 15:04:49
推荐回答(1个)
回答1:

不给分就太不对了,这里是简单的演示,给你一个思路。按照图片上的布局摆放控件,命名在左下角。然后把上面的代码复制粘贴就OK了

源码:

Option Explicit

Dim str As String

Private Sub cmdClose_Click()

End

End Sub

Private Sub cmdStart_Click()

str = Text1.Text

Timer1.Enabled = True

Text1.Locked = True

End Sub

Private Sub cmdStop_Click()

Timer1.Enabled = False

Text1.Enabled = True

End Sub

Private Sub Form_Load()

Option1.Item(1).Value = True

Timer1.Enabled = False

End Sub

Private Sub Option1_Click(Index As Integer)

Select Case Index

Case 0

Timer1.Interval = 500

Case 1

Timer1.Interval = 250

Case 2

Timer1.Interval = 50

End Select

End Sub

Private Sub Timer1_Timer()

Text1.Text = Space(2) + Text1.Text

If (Len(Text1.Text) > 50) Then

Text1.Text = str

End If

End Sub