VB滚动字幕:要求 字幕从左到右移动到窗体边缘消失,再从右到左出现。 。。。

VB滚动字幕:控件有command1=左移command2=右移command3=停止timer1语句如下:Dima%'定义a为整形同等于DimaasIntegerPri... VB滚动字幕: 控件有 command1=左移 command2=右移 command3=停止 timer1 语句如下:Dim a% '定义a为整形 同等于 Dim a as Integer Private Sub Command1_Click() a = 1 Timer1.Enabled = True '启动定时器 End Sub Private Sub Command2_Click() a = 2 Timer1.Enabled = True '启动定时器 End Sub Private Sub Command3_Click() Timer1.Enabled = False End Sub Private Sub Timer1_Timer() 'If……Then……语句 If a = 1 Then If Label1.Left + Label1.Width > 0 Then '标签1窗体左侧距离+标签1的宽度>0 Label1.Left = Label1.Left - 50 Else Label1.Left = Me.Width '标签1左侧的距离=窗体的宽度 同等于 label1.left = form1.width End If Else If Label1.Left + Label1.Width < Me.Width Then '标签1窗体左侧距离+标签1的宽度<窗体1的宽度 Label1.Left = Label1.Left + 50 Else Label1.Left = 0 - Me.Left '标签1左侧的距离 = 窗体1右侧的距离 End If End If End Sub 我没觉得我语句哪出毛病了!但是问题是【标签1】的字幕无法依次从左到右消失,再从右向左出现,还没消失完就在右侧出现字幕了,求教!! 在此,向所有关注过我问题的朋友们说声: 谢谢! 展开
 我来答
朴素又明快灬拉布拉多3091
推荐于2017-12-15 · TA获得超过187个赞
知道答主
回答量:148
采纳率:100%
帮助的人:66万
展开全部
'这不知是不是你想要达到的效果 Dim a As Integer Private Sub Command1_Click() a = 1 Timer1.Enabled = True '启动定时器 End Sub Private Sub Command2_Click() a = 2 Timer1.Enabled = True '启动定时器 End Sub Private Sub Command3_Click() Timer1.Enabled = False End Sub Private Sub Form_Load() Timer1.Enabled = False End Sub Private Sub Timer1_Timer() 'If……Then……语句 If a = 1 Then If Label1.Left + Label1.Width > 0 Then '标签1窗体左侧距离+标签1的宽度>0 Label1.Left = Label1.Left - 50 Else Label1.Left = -Label1.Width '标签1左侧的距离=窗体的宽度 同等于 label1.left = form1.width a = 2 End If Else If Label1.Left <= Me.Width Then '标签1窗体左侧距离+标签1的宽度<窗体1的宽度 Label1.Left = Label1.Left + 50 Else Label1.Left = Me.Width '标签1左侧的距离 = 窗体1右侧的距离 a = 1 End If End If End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式