📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4575
ClientLeft = 60
ClientTop = 390
ClientWidth = 6345
LinkTopic = "Form1"
ScaleHeight = 4575
ScaleWidth = 6345
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text2
Height = 735
Left = 2400
TabIndex = 3
Top = 2400
Width = 2055
End
Begin VB.CommandButton Command2
Caption = "Command2"
Height = 855
Left = 4920
TabIndex = 2
Top = 2760
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 855
Left = 600
TabIndex = 1
Top = 2760
Width = 1095
End
Begin VB.TextBox Text1
Height = 735
Left = 2400
TabIndex = 0
Text = "2.223"
Top = 720
Width = 2055
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim a As Single, a0 As Single
a = Val(Text1.Text)
Select Case a
Case Is < 1
a0 = Val(Str(Left(a, 3))) 'vb 中0.556记为.556,故取三个字符
If a - a0 > 0.005 Then
a0 = a0 + 0.01
End If
Case Is < 10
a0 = Val(Str(Left(a, 4)))
If a - a0 > 0.005 Then
a0 = a0 + 0.01
End If
Case Is < 100
a0 = Val(Str(Left(a, 4)))
If a - a0 > 0.05 Then
a0 = a0 + 0.1
End If
Case Is >= 100
a0 = Val(Str(Left(a, 3))) * 10 ^ (Len("Str(Int(a))") - 3)
If a - a0 > (10 ^ (Len("Str(Int(a))"))) / 2 Then
a0 = a0 + 10 ^ (Len("Str(Int(a))"))
End If
End Select
Text2.Text = a0
End Sub
Private Sub Command2_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -