English 中文(简体)
一段时间内更改标签
原标题:Change a label over a time increment

我正试图打上一个标签,在一次事件中每两次改变一次。 目前,我已经使睡觉完全从“冲击”到“Shoot”的路,并ski出“Paper”和“Scissors”。 没有人对我应该做些什么来适当展示标签,以便他们在平等时间的 in子中展示? 任何帮助都会受到高度赞赏。

lblCountdown.Text = "Rock"
System.Threading.Thread.Sleep(1000)
lblCountdown.Text = "Paper"
System.Threading.Thread.Sleep(1000)
lblCountdown.Text = "Scissors"
System.Threading.Thread.Sleep(1000)
lblCountdown.Text = "Shoot!"
最佳回答

如果你重新从国际不动产交易所接手,那么,在完成该法典之前,就将停下来,这样,你就获得了纸张或纸张。 一种解决办法(而不是best Solutions,但a > 解决办法)是:Me.Refresh(Application.DoEvents( > before each Sleep。 这将使国际不动产业联合会能够自行重组。

更好的解决办法是使用某种时间,在第二个间隔期时采用这一尺度,然后在另一个侧面进行操作,使贵方能为更重要的事情脱下。

问题回答

时间的推移和发誓是解决这一问题的好办法:

Private WithEvents m_tmrGame As New System.Timers.Timer(1000)
Private m_intShouldBeAnEnum As Integer = 1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    m_tmrGame.Start()

End Sub

Private Sub m_tmrGame_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles m_tmrGame.Elapsed

    Dim strCurrentObject As String = String.Empty

    Select Case m_intShouldBeAnEnum
        Case 1
            strCurrentObject = "Rock"
            m_intShouldBeAnEnum = 2
        Case 2
            strCurrentObject = "Paper"
            m_intShouldBeAnEnum = 3
        Case 3
            strCurrentObject = "Scissors"
            m_intShouldBeAnEnum = 4
        Case 4
            strCurrentObject = "Shoot!"
            m_intShouldBeAnEnum = 1
            m_tmrGame.Stop()
    End Select

    lblCountdown.Invoke(Sub(lblTarget As Label) lblTarget.Text = strCurrentObject, New Object() {lblCountdown})

End Sub




相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签