📄 form1.frm
字号:
Text2.Text = Text2.Text + c
Else: Text2.Text = "输入错误"
Exit For
End If
Next
Else: Text2.Text = "您没有输入任何数字"
End If
End If
'--------------十六进制->二进制---------------
If an2.Value Then
If Text1.Text <> "" Then
Text2.Text = ""
l = Len(Text1.Text)
For i = 1 To l
a = Mid(Text1.Text, i, 1)
If a <= "9" And a >= "0" Or a <= "f" And a >= "a" Or a <= "F" And a >= "A" Then
Select Case a
Case "0": Text2.Text = Text2.Text + "0000"
Case "1": Text2.Text = Text2.Text + "0001"
Case "2": Text2.Text = Text2.Text + "0010"
Case "3": Text2.Text = Text2.Text + "0011"
Case "4": Text2.Text = Text2.Text + "0100"
Case "5": Text2.Text = Text2.Text + "0101"
Case "6": Text2.Text = Text2.Text + "0110"
Case "7": Text2.Text = Text2.Text + "0111"
Case "8": Text2.Text = Text2.Text + "1000"
Case "9": Text2.Text = Text2.Text + "1001"
Case "a", "A": Text2.Text = Text2.Text + "1010"
Case "b", "B": Text2.Text = Text2.Text + "1011"
Case "c", "C": Text2.Text = Text2.Text + "1100"
Case "d", "D": Text2.Text = Text2.Text + "1101"
Case "e", "E": Text2.Text = Text2.Text + "1110"
Case "f", "F": Text2.Text = Text2.Text + "1111"
Case Else: Text2.Text = "输入错误"
End Select
Else: Text2.Text = "输入错误"
End If
Next
Else: Text2.Text = "您没有输入任何数字"
End If
End If
'--------------十进制->二进制-----------------
If an3.Value Then
If Text1.Text <> "" Then
Text2.Text = ""
a = Text1.Text
l = Len(Text1.Text)
If a <> 0 Then
For i = 1 To l
c = Mid(Text1.Text, i, 1)
If c >= "0" And c <= "9" Then
Do While a
r = a Mod 2
a = a \ 2
Text2.Text = r & Text2.Text
Loop
Else: Text2.Text = "输入错误"
Exit Sub
End If
Next
Else: Text2.Text = a
End If
Else: Text2.Text = "您没有输入任何数字"
End If
End If
End Sub
Private Sub x2_Click()
'-----------二进制->十六进制----------------
Text2.Text = ""
If an1.Value Then
If Text1.Text <> "" Then
l = Len(Text1.Text)
d = l Mod 4
If d = 0 Then
c = l / 4
ReDim result(c)
For i = 1 To c
If Text2.Text <> "输入错误" Then
e = (c - 1) * 4
tmp = Mid(Text1.Text, e + 1, 4)
Call choice(tmp)
c = c - 1
Else: Exit For
End If
Next
Else: c = Int(l / 4)
ReDim result(c)
g = c
g = g + 1
For i = 1 To g
If Text2.Text <> "输入错误" Then
If c <> 0 Then
e = (c - 1) * 4
tmp = Mid(Text1.Text, e + 1 + d, 4)
Call choice(tmp)
c = c - 1
g = g - 1
ElseIf c = 0 Then
tmp = Mid(Text1.Text, 1, d)
Call choice(tmp)
c = c - 1
g = g - 1
End If
Else: Exit For
End If
Next
End If
Else: Text2.Text = "您没有输入任何数字"
End If
End If
'--------------------------------------------
'----------------十六进制->十六进制----------
If an2.Value Then
Text2.Text = ""
If Text1.Text <> "" Then
l = Len(Text1.Text)
For i = 1 To l
c = Mid(Text1.Text, i, 1)
If c = "0" Or c = "1" Or c = "2" Or c = "3" Or c = "4" Or c = "5" Or c = "6" Or c = "7" Or c = "8" Or c = "9" Or c = "a" Or c = "b" Or c = "e" Or c = "d" Or c = "c" Or c = "f" Then
Text2.Text = Text2.Text + c
Else: Text2.Text = "输入错误"
Exit For
End If
Next
Else: Text2.Text = "您没有输入任何数字"
End If
End If
'--------------十进制->十六进制----------------
If an3.Value Then
If Text1.Text <> "" Then
Text2.Text = ""
a = Text1.Text
l = Len(Text1.Text)
If a <> 0 Then
For i = 1 To l
c = Mid(Text1.Text, i, 1)
If c >= "0" And c <= "9" Then
Do While a
r = a Mod 16
a = a \ 16
Select Case r
Case 0: r = "0"
Case 1: r = "1"
Case 2: r = "2"
Case 3: r = "3"
Case 4: r = "4"
Case 5: r = "5"
Case 6: r = "6"
Case 7: r = "7"
Case 8: r = "8"
Case 9: r = "9"
Case 10: r = "a"
Case 11: r = "b"
Case 12: r = "c"
Case 13: r = "d"
Case 14: r = "e"
Case 15: r = "f"
End Select
Text2.Text = r + Text2.Text
Loop
Else: Text2.Text = "输入错误"
Exit Sub
End If
Next
Else: Text2.Text = a
End If
Else: Text2.Text = "您没有输入任何数字"
End If
End If
End Sub
Private Sub x3_Click()
'-------------二进制->十进制------------
If an1.Value Then
If Text1.Text <> "" Then
Text2.Text = "0"
l = Len(Text1.Text)
For i = 1 To l
tmp1 = 1
a = 0
c = Mid(Text1.Text, i, 1)
If c = "1" Or c = "0" Then
If Int(c) <> 0 Then
For j = 1 To l - i
tmp1 = tmp1 * 2
Next
a = a + tmp1
End If
Else: Text2.Text = "输入错误"
Exit For
End If
Text2.Text = Text2.Text + a
Next
Else: Text2.Text = "您没有输入任何数字"
End If
End If
'------------------------
'------------十进制->十进制------------
If an3.Value Then
Text2.Text = ""
If Text1.Text <> "" Then
l = Len(Text1.Text)
For i = 1 To l
c = Mid(Text1.Text, i, 1)
If c = "1" Or c = "2" Or c = "3" Or c = "4" Or c = "5" Or c = "6" Or c = "7" Or c = "8" Or c = "9" Or c = "0" Then
Text2.Text = Text2.Text + c
Else: Text2.Text = "输入错误"
Exit For
End If
Next
Else: Text2.Text = "您没有输入任何数字"
End If
End If
'----------------十六进制->十进制---------------
If an2.Value Then
If Text1.Text <> "" Then
Text2.Text = "0"
l = Len(Text1.Text)
For i = 1 To l
tmp1 = 1
a = 0
c = Mid(Text1.Text, i, 1)
Select Case c
Case "0": tmp1 = 0
Case "1": tmp1 = 1
Case "2": tmp1 = 2
Case "3": tmp1 = 3
Case "4": tmp1 = 4
Case "5": tmp1 = 5
Case "6": tmp1 = 6
Case "7": tmp1 = 7
Case "8": tmp1 = 8
Case "9": tmp1 = 9
Case "a", "A": tmp1 = 10
Case "b", "B": tmp1 = 11
Case "c", "C": tmp1 = 12
Case "d", "D": tmp1 = 13
Case "e", "E": tmp1 = 14
Case "f", "F": tmp1 = 15
End Select
If c <= "9" And c >= "0" Or c <= "f" And c >= "a" Or c <= "F" And c >= "A" Then
If c <> 0 Then
For j = 1 To l - i
tmp1 = tmp1 * 16
Next
a = a + tmp1
End If
Else: Text2.Text = "输入错误"
Exit For
End If
Text2.Text = Text2.Text + a
Next
Else: Text2.Text = "您没有输入任何数字"
End If
End If
End Sub
Private Sub x4_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -