2个回答
2013-09-14
展开全部
把下面的文本,不带*。的复制到文本里面,保存存一下,用VB打开就可以了
*。*。*。*。*。*。。
VERSION 5.00
Begin VB.Form Form1
Caption = "Marquee"
ClientHeight = 3960
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3960
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "跑马灯结束"
Height = 495
Left = 2640
TabIndex = 5
Top = 3360
Width = 1215
End
Begin VB.Timer Timer1
Left = 2160
Top = 3480
End
Begin VB.CommandButton Command1
Caption = "跑马灯开始"
Height = 495
Left = 840
TabIndex = 2
Top = 3360
Width = 1215
End
Begin VB.TextBox Text2
Height = 1215
Left = 840
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Text = "新建 文本文档.frx":0000
Top = 1920
Width = 3135
End
Begin VB.TextBox Text1
BackColor = &H80000018&
Height = 375
Left = 1200
TabIndex = 0
Top = 360
Width = 2895
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "请输入跑马灯文字"
Height = 375
Left = 1320
TabIndex = 4
Top = 1200
Width = 2295
End
Begin VB.Label Label2
Caption = "Text 跑马灯"
Height = 375
Left = 120
TabIndex = 3
Top = 360
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'宣告要在 Text1 裏显示的跑马灯字串变数
Dim TString As String
Private Sub Command1_Click()
'宣告储存 Text1 字串长度的变数
Dim TWidth As Long
Command2.Enabled = True
'启动 Timer 显示跑马灯
Timer1.Enabled = True
Command1.Enabled = False
'text2 裏必须输入跑马灯字串
If Text2.Text = "" Then
MsgBox "请输入跑马灯文字"
'没有输入就按下 Command2 跑马灯结束钮
Command2_Click
Exit Sub
End If
'统计 Text1Box 裏到底放的下几个字
Do While TextWidth(Space(TWidth)) <= Text1.Width
TWidth = TWidth + 1
Loop
'设定跑马灯字串为 Text1 宽度个空白
'加原输入的 跑马灯文字
TString = Space(TWidth) + Text2.Text
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Command1.Enabled = True
Command2.Enabled = False
'关闭跑马灯显示
Timer1.Enabled = False
Text2.SetFocus
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 200
Command2.Enabled = False
'将各元件 Font 统一,利於计算字串宽度
Text1.Font = Me.Font
Text2.Font = Me.Font
Me.Show
Text2.SetFocus
End Sub
Private Sub Timer1_Timer()
'开始颉取跑马灯字串之位置指标
Static TPos As Long
'如果位置指标越过了整个字串
If TPos > Len(TString) Then
'把位置指标移到最开头
TPos = 1
Else
'把位置指标移到下一个字
TPos = TPos + 1
End If
'逐字显示跑马灯字串
Text1.Text = Mid(TString, TPos)
End Sub
*。*。*。*。*。*。。
VERSION 5.00
Begin VB.Form Form1
Caption = "Marquee"
ClientHeight = 3960
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3960
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "跑马灯结束"
Height = 495
Left = 2640
TabIndex = 5
Top = 3360
Width = 1215
End
Begin VB.Timer Timer1
Left = 2160
Top = 3480
End
Begin VB.CommandButton Command1
Caption = "跑马灯开始"
Height = 495
Left = 840
TabIndex = 2
Top = 3360
Width = 1215
End
Begin VB.TextBox Text2
Height = 1215
Left = 840
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Text = "新建 文本文档.frx":0000
Top = 1920
Width = 3135
End
Begin VB.TextBox Text1
BackColor = &H80000018&
Height = 375
Left = 1200
TabIndex = 0
Top = 360
Width = 2895
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "请输入跑马灯文字"
Height = 375
Left = 1320
TabIndex = 4
Top = 1200
Width = 2295
End
Begin VB.Label Label2
Caption = "Text 跑马灯"
Height = 375
Left = 120
TabIndex = 3
Top = 360
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'宣告要在 Text1 裏显示的跑马灯字串变数
Dim TString As String
Private Sub Command1_Click()
'宣告储存 Text1 字串长度的变数
Dim TWidth As Long
Command2.Enabled = True
'启动 Timer 显示跑马灯
Timer1.Enabled = True
Command1.Enabled = False
'text2 裏必须输入跑马灯字串
If Text2.Text = "" Then
MsgBox "请输入跑马灯文字"
'没有输入就按下 Command2 跑马灯结束钮
Command2_Click
Exit Sub
End If
'统计 Text1Box 裏到底放的下几个字
Do While TextWidth(Space(TWidth)) <= Text1.Width
TWidth = TWidth + 1
Loop
'设定跑马灯字串为 Text1 宽度个空白
'加原输入的 跑马灯文字
TString = Space(TWidth) + Text2.Text
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Command1.Enabled = True
Command2.Enabled = False
'关闭跑马灯显示
Timer1.Enabled = False
Text2.SetFocus
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 200
Command2.Enabled = False
'将各元件 Font 统一,利於计算字串宽度
Text1.Font = Me.Font
Text2.Font = Me.Font
Me.Show
Text2.SetFocus
End Sub
Private Sub Timer1_Timer()
'开始颉取跑马灯字串之位置指标
Static TPos As Long
'如果位置指标越过了整个字串
If TPos > Len(TString) Then
'把位置指标移到最开头
TPos = 1
Else
'把位置指标移到下一个字
TPos = TPos + 1
End If
'逐字显示跑马灯字串
Text1.Text = Mid(TString, TPos)
End Sub
2013-09-14
展开全部
用定时器,改变Label的位置
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询