用VB做一个简单的小程序

用VB做一个简单的小程序,第1张

Private Sub Command1_Click()

  Me.Cls

  Dim N As Integer, i As Integer

  N = InputBox("n=", , 袭李9)

  For i = 1 To 2 * N - 1

    If i <= N Then

      Print Space(N - i) + String(2 * i - 1, CStr(i))

    Else

      Print Space(N - (2 行禅裂* N - i)) + String(2 * (2 * N - i) - 1, CStr(2 * N 档闭- i))

    End If

  Next i

End Sub

Dim sec, min, h

Private Sub Command1_Click()

Timer1.Enabled = True

h = Text1.Text

min = Text2.Text

sec = Text3.Text

Timer2.Enabled = False

End Sub

Private Sub Command2_Click()

End

End Sub

Private Sub Form_Load()

Form1.BackColor = &HFFFF00

Timer1.Enabled = False

Timer1.Interval = 1000

Timer2.Enabled = True

Timer2.Interval = 1000

Text1.Text = 2

Text2.Text = "00"

Text3.Text = "00"轮握

Command2.Caption = "腊册庆退出"

Command1.Caption = "开始倒计时"姿罩

End Sub

Private Sub Timer1_Timer()

If sec >0 Then

sec = sec - 1

Else:

If (min >0 Or h >0) Then

sec = 59

End If

If min >0 Then

min = min - 1

Else:

If h >0 Then

min = 59

End If

If h >0 Then

h = h - 1

Else: Timer1.Enabled = False

CreateObject("SAPI.SpVoice").Speak "GAME OVER!"

Form1.BackColor = &HFF

End If

End If

End If

Text1.Text = h

Text2.Text = min

Text3.Text = sec

Label6.Caption = Now

End Sub

Private Sub Timer2_Timer()

Label6.Caption = Now

End Sub


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12365301.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存