用VB设计字从左到右,从右到左,从上到下,从下到上的滑动谢谢了,大神帮忙啊
分别用四个计时器对该对应的字进行设置,如果字滑动到了窗体边就从窗体的另一边过来,以此类推......
分别用四个计时器对该对应的字进行设置,如果字滑动到了窗体边就从窗体的另一边过来,以此类推...
展开
2个回答
展开全部
添加下面代码到窗体中测试,在窗体上添加4个按钮,按Command1,向上滚动,按Command2向下滚动,按Command3向左滚动,按Command4向右滚动 Private Sub Command1_Click() Timer1.Enabled = True Timer2.Enabled = False Timer3.Enabled = False Timer4.Enabled = False End Sub Private Sub Command2_Click() Timer1.Enabled = False Timer2.Enabled = True Timer3.Enabled = False Timer4.Enabled = False End Sub Private Sub Command3_Click() Timer1.Enabled = False Timer2.Enabled = False Timer3.Enabled = True Timer4.Enabled = False End Sub Private Sub Command4_Click() Timer1.Enabled = False Timer2.Enabled = False Timer3.Enabled = False Timer4.Enabled = True End Sub Private Sub Form_Load() Timer1.Enabled = False Timer2.Enabled = False Timer3.Enabled = False Timer4.Enabled = False Timer1.Interval = 200 Timer2.Interval = 200 Timer3.Interval = 200 Timer4.Interval = 200 Label1.AutoSize = True End Sub Private Sub Timer1_Timer() Label1.Top = Label1.Top - 60 If Label1.Top + Label1.Height <= 0 Then Label1.Top = Me.Height - 400 End If End Sub Private Sub Timer2_Timer() Label1.Top = Label1.Top + 60 If Label1.Top >= Me.Height - 400 Then Label1.Top = -Label1.Height End If End Sub Private Sub Timer3_Timer() Label1.Left = Label1.Left - 60 If Label1.Left <= -Label1.Width Then Label1.Left = Me.Width - 100 End If End Sub Private Sub Timer4_Timer() Label1.Left = Label1.Left + 60 If Label1.Left >= Me.Width - 100 Then Label1.Left = -Label1.Width End If End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click() Timer1.Enabled = True Timer2.Enabled = True Timer3.Enabled = True Timer4.Enabled = True End Sub Private Sub Command2_Click() Timer1.Enabled = False Timer2.Enabled = False Timer3.Enabled = False Timer4.Enabled = False End Sub Private Sub Timer1_Timer() If Label1.Left <= Form1.Width - Label1.Width Then Label1.Left = Label1.Left + 50 Else Label1.Left = 0 End If End Sub Private Sub Timer2_Timer() If Label2.Top <= Form1.Height - Label2.Height Then Label2.Top = Label2.Top + 50 Else Label2.Top = 0 End If End Sub Private Sub Timer3_Timer() If Label3.Top >= 0 Then Label3.Top = Label3.Top - 50 Else Label3.Top = Form1.Height - Label3.Height End If End Sub Private Sub Timer4_Timer() If Label4.Left > 0 Then Label4.Left = Label4.Left - 50 Else Label4.Left = Form1.Width End If End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询