📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00E0E0E0&
Caption = "数制转换 "
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
FillColor = &H00C0C0C0&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "转换"
Height = 375
Left = 1080
TabIndex = 6
Top = 2640
Width = 1215
End
Begin VB.TextBox Text3
Height = 360
Left = 2160
TabIndex = 5
Top = 1800
Width = 1215
End
Begin VB.TextBox Text2
Height = 360
Left = 2160
TabIndex = 4
Top = 960
Width = 1215
End
Begin VB.TextBox Text1
Height = 360
Left = 2160
TabIndex = 3
Top = 480
Width = 1215
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "转换成16进制数"
Height = 240
Left = 120
TabIndex = 2
Top = 1800
Width = 1680
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "输入R进制:(2-16)"
Height = 480
Left = 600
TabIndex = 1
Top = 960
Width = 1320
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "输入十进制数:"
Height = 240
Left = 360
TabIndex = 0
Top = 480
Width = 1680
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Function trandec$(ByVal m%, ByVal r%)
Dim strdtor$
Dim ib%, mr%
strdtor = ""
Do While m <> 0
mr = m Mod r
m = m \ r
If mr >= 10 Then
strdtor = Chr(mr - 10 + 65) & strdtor
Else
strdtor = mr & strdtor
End If
Loop
trandec = strdtor
End Function
Private Sub Command1_Click()
Dim m0%, r0%, i%
m0 = Val(Text1.Text)
r0 = Val(Text2.Text)
If r0 < 2 Or r0 > 16 Then
i = MsgBox(" 输入的R进制数超出范围", vbRetryCancel)
If i = vbRetry Then
Text2.Text = ""
Text2.SetFocus
Else
End
End If
End If
Label3.Caption = "转换成" & r0 & "进制数"
Text3.Text = trandec(m0, r0)
End Sub
Private Sub Form_Load()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -