VB如何实现label控件光标闪烁,求代码
1个回答
展开全部
1个timer(timer1) 2个label(label1,label2)1个textbox(text1),在text1中输入 看效果
Dim i As Long
Private Sub Form_Load()
Text1.Text = ""
Label1.Caption = ""
Label2.BackStyle = 0
Label2.Caption = "|"
Label2.Top = Label1.Top
Label2.Left = (Len(Label1.Caption)) * 90 + Label1.Left - 50
Timer1.Interval = 35
End Sub
Private Sub Text1_Change()
Label1.Caption = Text1.Text
End Sub
Private Sub Timer1_Timer()
Label2.Left = (Len(Label1.Caption)) * 90 + Label1.Left - 50
If i < 10 Then
i = i + 1
Else
Label2.Visible = Not Label2.Visible
i = 0
End If
End Sub
Dim i As Long
Private Sub Form_Load()
Text1.Text = ""
Label1.Caption = ""
Label2.BackStyle = 0
Label2.Caption = "|"
Label2.Top = Label1.Top
Label2.Left = (Len(Label1.Caption)) * 90 + Label1.Left - 50
Timer1.Interval = 35
End Sub
Private Sub Text1_Change()
Label1.Caption = Text1.Text
End Sub
Private Sub Timer1_Timer()
Label2.Left = (Len(Label1.Caption)) * 90 + Label1.Left - 50
If i < 10 Then
i = i + 1
Else
Label2.Visible = Not Label2.Visible
i = 0
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询