Const strSamp = "滚动文本演示" Dim bShow As Boolean Dim iScroll As IntegerPrivate Sub Form_Load() Timer1.Interval = 10 End SubPrivate Sub Timer1_Timer() If bShow Then bShow = False Picture1.Visible = False Picture2.Visible = True Picture1.Cls Picture1.CurrentX = iScroll Picture1.CurrentY = 30 Picture1.Print strSamp Else bShow = True Picture1.Visible = True Picture2.Visible = False Picture2.Cls Picture2.CurrentX = iScroll Picture2.CurrentY = 30 Picture2.Print strSamp End If iScroll = iScroll + 5 If iScroll > 3000 Then Timer1.Enabled = False End If End Sub
为什么用两个PictureBox?人为制造闪烁感?看不懂你的意思,去掉Picture2后,改成下面这样就行了Const strSamp = "滚动文本演示" Dim iScroll As Integer Private Sub Form_Load() Timer1.Interval = 10 End SubPrivate Sub Timer1_Timer() With Picture1 .Cls .CurrentX = iScroll .CurrentY = 30 Picture1.Print strSamp End With iScroll = iScroll + 5 If iScroll > 3000 Then Timer1.Enabled = False End If End Sub
http://www.freevbcode.com/code/scroll_text.zip
流畅就不好说了,它与个人感觉有关,一般每次移动越少、时间间隔越短,越流畅,但要与效率与资源占用挂钩。过分追求没必要。用label的left属性的方法,肯定有闪烁,因为它的擦除是VB自动进行的。另两个办法要看代码怎么写,贴出你的代码,可以帮你改改。
Dim bShow As Boolean
Dim iScroll As IntegerPrivate Sub Form_Load()
Timer1.Interval = 10
End SubPrivate Sub Timer1_Timer()
If bShow Then
bShow = False
Picture1.Visible = False
Picture2.Visible = True
Picture1.Cls
Picture1.CurrentX = iScroll
Picture1.CurrentY = 30
Picture1.Print strSamp
Else
bShow = True
Picture1.Visible = True
Picture2.Visible = False
Picture2.Cls
Picture2.CurrentX = iScroll
Picture2.CurrentY = 30
Picture2.Print strSamp
End If
iScroll = iScroll + 5
If iScroll > 3000 Then
Timer1.Enabled = False
End If
End Sub
Dim iScroll As Integer
Private Sub Form_Load()
Timer1.Interval = 10
End SubPrivate Sub Timer1_Timer()
With Picture1
.Cls
.CurrentX = iScroll
.CurrentY = 30
Picture1.Print strSamp
End With
iScroll = iScroll + 5
If iScroll > 3000 Then
Timer1.Enabled = False
End If
End Sub
1.timer1.interval=100
2.iScroll = iScroll + 15 15twip=1pixel 这样眼睛才会舒服点你试试看
你可新建一个工程,只用上面代码试试,可能是你的其它代码有问题autoredraw=true在这个代码中并不重要,可以不用。
http://www.mndsoft.com/blog/article.asp?id=206&keyword=%E5%B9%B3%E6%BB%91非常平滑的关于滚动字幕:
http://www.mndsoft.com/blog/article.asp?id=493&keyword=%E5%B9%B3%E6%BB%91平滑文字滚动控件:
http://www.mndsoft.com/blog/article.asp?id=665&keyword=%E5%B9%B3%E6%BB%91不够的话,自己再搜索吧,http://www.mndsoft.com