參考引用:VB.net 跑馬燈建立
--
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 150
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Try
If intPos <= Integer.Parse(message.Length) * -10 Then
intPos = StatusStrip1.Width
End If
intPos -= 5
StatusStrip1.Refresh()
StatusStrip1.CreateGraphics.DrawString(" " & message, StatusStrip1.Font, Brushes.Red, intPos, 6)
Catch ex As Exception
End Try
End Sub
---
底下改寫:
改寫:
Public Class Form1
Dim intPos As Integer
Dim message As String = "這是跑碼燈"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 150
Timer1.Enabled = True
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If intPos <= Integer.Parse(message.Length) * -10 Then
intPos = Txt1.Width
End If
intPos -= 5
Txt1.Refresh()
Txt1.CreateGraphics.DrawString(" " & message, Txt1.Font, Brushes.Red, intPos, 6)
End Sub
End Class
沒有留言:
張貼留言