Dim a(1 To 12) As String
Private Sub Command1_Click()
n = Combo1.Text
If n <= 0 Then MsgBox "请输入大于0的数!": Exit Sub
If n < 12 Then
n = n + 12
End If
If n >= 12 Then
r 睁氏激= n Mod 12
Select Case r
Case 核谈4: sx = 悉袜"鼠"
Case 5: sx = "牛"
Case 6: sx = "虎"
Case 7: sx = "兔"
Case 8: sx = "龙"
Case 9: sx = "蛇"
Case 10: sx = "马"
Case 11: sx = "羊"
Case 0: sx = "猴"
Case 1: sx = "鸡"
Case 2: sx = "狗"
Case 3: sx = "猪"
End Select
End If
Label1.Caption = sx
End Sub
Private Sub Form_Load()
Label1.Caption = ""
Label1.FontSize = 30
Label1.ForeColor = vbBlue
End Sub
Option Explicit
Private Sub Change_Pic()
'本子程序余羡将年份数字转化为生肖:
Dim intSX As Integer ‘表示生肖的数字
Dim strSX As String ’表示生肖的字符
Picture2.Cls
intSX = Val(Combo1.Text) Mod 12
Select Case intSX
Case 0
strSX = "猴"
Case 1
strSX = "鸡"
Case 2
strSX = "狗"
Case 3
strSX = "猪"
Case 4
strSX = "鼠"
Case 5
strSX = "牛"
Case 6
strSX = "虎"禅亮
Case 7
strSX = "兔"
Case 8
strSX = "龙"
Case 9
strSX = "蛇"
Case 10
strSX = "马"
Case 11
strSX = "羊"
End Select
'在左侧图像框显示文字
Picture2.Print strSX &"年"
'在右侧图像框显示图片。事先要将准备好的生肖图片以生肖名命名,如“猴.jpg”等,放在
'应用程序所在的文件夹中。
Picture1.Picture = LoadPicture(App.Path &"\贺毁宽" &strSX &".jpg")
End Sub
Private Sub Combo1_Change()
If Len(Combo1.Text) = 4 And IsNumeric(Combo1.Text) Then
Call Change_Pic
Else
Picture1.Cls
Picture2.Cls
End If
End Sub
Private Sub Combo1_Click()
Call Change_Pic
End Sub
Private Sub Form_Activate()
Call Change_Pic
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 1901 To 2300
Combo1.AddItem (i)
Next
Combo1.Text = Year(Now)
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)