VB中timer控件的用法
我想实现timer控件的一个用法?
例如:  
Private Sub Command1_Click()
Timer1.Enabled = True
End SubPrivate Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = False
Label1.Visible = False
End SubPrivate Sub Timer1_Timer()
 Label1.Visible = True
End Sub想实现
以上程序中,第一步:Label1.Visible = True与 Timer1.Enabled = True  同时执行;
      然后,过Timer1过1000,Label1.Visible = True执行一次;
有无好办法? 以上是老前辈的提供的源吗?

解决方案 »

  1.   


    Private Sub Timer1_Timer()
    Label1.Visible = Not Label1.Visible
    End Sub你是不是想要这种效果
      

  2.   

    "Private Sub Timer1_Timer()
    Label1.Visible = Not Label1.Visible
    End Sub" 好像不能实现吧
      

  3.   

    Private Sub Command1_Click()
    Timer1.Enabled = True
    Timer2.Enabled = True
    End SubPrivate Sub Form_Load()
    Timer1.Interval = 1000
    Timer2.Interval = 10'可以改的间隔小些
    Timer1.Enabled = False
    Label1.Visible = False
    End SubPrivate Sub Timer1_Timer()
        
      Label1.Visible = True
    End SubPrivate Sub Timer2_Timer()
        If Label1.Visible = True Then
            Label1.Visible = False
        End IfEnd Sub
    再加一个Timer就可以了,一个控制显示,另一个控制不显示。把控制不显示的Timer的时间间隔设置小些,这样看上去Label是一闪一闪的效果。
    不知道楼主要的是不是这个样子。
      

  4.   

    但不知是否是LZ想要的效果
    Option Explicit
        Dim flagLab As Boolean
    Private Sub Command1_Click()
        Timer1.Enabled = True
    End SubPrivate Sub Form_Load()
        Timer1.Interval = 1000
        Timer1.Enabled = False
        Label1.Visible = False
    End SubPrivate Sub Timer1_Timer()
        If flagLab Then
        Label1.Visible = True
        Else
        Label1.Visible = False
        End If
        flagLab = Not flagLab
    End Sub