📄 公元干支转换.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H80000013&
Caption = "公元干支转换"
ClientHeight = 4170
ClientLeft = 60
ClientTop = 450
ClientWidth = 6975
LinkTopic = "Form1"
ScaleHeight = 4170
ScaleWidth = 6975
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "清空"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 4800
TabIndex = 7
Top = 1680
Width = 1455
End
Begin VB.CommandButton Command1
BackColor = &H80000013&
Cancel = -1 'True
Caption = "转换"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 4800
TabIndex = 6
Top = 480
UseMaskColor = -1 'True
Width = 1455
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2280
TabIndex = 5
Top = 2880
Width = 1695
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "幼圆"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2280
TabIndex = 3
Top = 1680
Width = 1695
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2280
TabIndex = 1
Top = 480
Width = 1695
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "属 相"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 480
TabIndex = 4
Top = 3000
Width = 1200
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "干支纪年"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 480
TabIndex = 2
Top = 1800
Width = 1200
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "输入年份"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 480
TabIndex = 0
Top = 600
Width = 1200
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim year As String
Private Sub Text1_Change()
year = Text1.Text
If year <= -32768 Or year >= 32767 Then
MsgBox "年份超出范围", vbRetryCancel, "错误"
End If
Text1.SetFocus
End Sub
Private Sub Command1_Click()
Dim tiangan As String
Dim dizhi As String
Dim shuxiang As String
If year = "" Then
MsgBox "年份不能为空", vbRetryCancel, "错误"
End If
Select Case year Mod 10
Case 0
tiangan = "庚"
Case 1
tiangan = "辛"
Case 2
tiangan = "壬"
Case 3
tiangan = "癸"
Case 4
tiangan = "甲"
Case 5
tiangan = "乙"
Case 6
tiangan = "丙"
Case 7
tiangan = "丁"
Case 8
tiangan = "戊"
Case 9
tiangan = "己"
End Select
Select Case year Mod 12
Case 0
dizhi = "申"
shuxiang = "猴"
Case 1
dizhi = "酉"
shuxiang = "鸡"
Case 2
dizhi = "戌"
shuxiang = "狗"
Case 3
dizhi = "亥"
shuxiang = "猪"
Case 4
dizhi = "子"
shuxiang = "鼠"
Case 5
dizhi = "丑"
shuxiang = "牛"
Case 6
dizhi = "寅"
shuxiang = "虎"
Case 7
dizhi = "卯"
shuxiang = "兔"
Case 8
dizhi = "辰"
shuxiang = "龙"
Case 9
dizhi = "巳"
shuxiang = "蛇"
Case 10
dizhi = "午"
shuxiang = "马"
Case 11
dizhi = "未"
shuxiang = "羊"
End Select
Text2.Text = tiangan + dizhi + "年"
Text3.Text = shuxiang + "年"
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -