【Android】安卓APP->进制计算器
这个进制计算器的作用就是用于转换进制。支持的进制很多,从2开始,到36,也就是最小二进制,最高支持到36进制。低于十的数字用0123456789表示,而从十开始,则用ABCDEF等字母来表示。因为总共10个数字字符,26个英文字母,因此最高支持到36进制。(因为不知道超过36的数字用什么来表示。兴许可以弄一个中文表示法,来表示更多的进位制。)这是截图,无视右上角的“中国移不动”吧。其中第一个文本框用于输入要转换的数字,反正只要字符和对应的进制对应就行了。然后就是输入数字的进位制、输出数字的进位制。
输入好以后,点“计算”,就能算出结果来了。
源代码:package com.Xaa55.numsysconv;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity
{
EditText etInput,etOutput,etInputSystem,etOutputSystem;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etInput=(EditText)findViewById(R.id.etInput);
etOutput=(EditText)findViewById(R.id.etOutput);
etInputSystem=(EditText)findViewById(R.id.etInputSystem);
etOutputSystem=(EditText)findViewById(R.id.etOutputSystem);
}
//进行计算的程序
public void Calc(View view)
{
String StringInput;//输入的数字字符串
int cbInput;//输入的数字字符串的长度
String StringInputSystem;//输入的进制数字符串
String StringOutputSystem;//输出的进制数字符串
int InputSystem;//输入的进制数
int OutputSystem;//输出的进制数
int i=0,j=0,k=0;
//读取输入的进制数字符串
StringInputSystem=etInputSystem.getText().toString();
if(StringInputSystem.length()==0)
{
Toast.makeText(this,"请输入进位制。",Toast.LENGTH_SHORT).show();
return;
}
//读取输出的进制数字符串
StringOutputSystem=etOutputSystem.getText().toString();
if(StringOutputSystem.length()==0)
{
Toast.makeText(this,"请输入进位制。",Toast.LENGTH_SHORT).show();
return;
}
//读取输入的数字字符串
StringInput=etInput.getText().toString();
StringInput.trim();
char InputChars[]=StringInput.toCharArray();
cbInput=InputChars.length;
if(cbInput<=0)
{
Toast.makeText(this, "请输入数字,谢谢。" , Toast.LENGTH_SHORT).show();
return;
}
InputSystem=Integer.parseInt(StringInputSystem);//输入的进制数
OutputSystem=Integer.parseInt(StringOutputSystem);//输出的进制数
if(InputSystem>36||OutputSystem>36)
{
Toast.makeText(this,
"本程序不支持超过36进制的数字的运算,因为不知道超出的部分要用什么符号表示。",
Toast.LENGTH_SHORT).show();
return;
}
if(InputSystem<2||OutputSystem<2)
{
Toast.makeText(this,"1进制?0进制?你想太多了吧。。。",
Toast.LENGTH_SHORT).show();
return;
}
char InputValues[]=new char,ch;
for (;i<cbInput;i++)
{
if(InputChars>='a' && InputChars<='z')
ch=(char)(InputChars-'a'+10);
else if(InputChars>='A' && InputChars<='Z')
ch=(char)(InputChars-'A'+10);
else if(InputChars>='0' && InputChars<='9')
ch=(char)(InputChars-'0');
else if (InputChars=='.')
{
Toast.makeText(this,"暂不支持小数运算。",Toast.LENGTH_SHORT).show();
return;
}
else
{
etInput.setSelection(i, i+1);
Toast.makeText(this, "输入的数字不合法。" , Toast.LENGTH_SHORT).show();
return;
}
if(ch>=InputSystem)
{
etInput.setSelection(i,i+1);
Toast.makeText(this,"输入的数字不合法。",Toast.LENGTH_SHORT).show();
return;
}
InputValues=ch;
}
String strOut="";
do
{
for(j=i=ch=0;i<cbInput;i++)
{
k=j*InputSystem+InputValues;
InputValues=(char)(k/OutputSystem);
j=k%OutputSystem;
ch|=InputValues;
}
if(j<10)
strOut=j+strOut;
else
strOut=String.valueOf((char)(j-10+'A'))+strOut;
}while(ch!=0);
etOutput.setText(strOut);
}
}最后这几行代码是关键,从第76行开始,是处理输入的字符串,然后将其转换为数字。第105行开始是把数字再按照指定的进制进行转换,然后输出。
感觉Android Studio还是挺方便的。虽然对于我总是要翻墙下载完整的SDK才愿意开始开发(硬盘大,所以才任性)
顺带吐槽一下Android Studio使用新宋体会有ClearType的效果!天啊实在是受不了了。只能用Courier New了。还有就是我习惯把{放在新行,否则也很不爽
BIN:
SRC: 確かに、写小程序用Java也确实省时省力哈。 {:soso_e179:} 哈哈哈哈!好!跟风发一个:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1'Fixed Single
Caption = "SCAL"
ClientHeight = 4305
ClientLeft = 45
ClientTop = 375
ClientWidth = 4545
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4305
ScaleWidth = 4545
StartUpPosition = 2'屏幕中心
Begin VB.CommandButton Command3
Caption = "&X"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3600
TabIndex = 28
ToolTipText = "清空"
Top = 120
Width = 375
End
Begin VB.Frame Frame2
Caption = "单位转换"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1695
Left = 120
TabIndex = 17
Top = 2520
Width = 4335
Begin VB.CommandButton Command4
Caption = "&D"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 29
ToolTipText = "清空"
Top = 240
Width = 375
End
Begin VB.TextBox Text6
BackColor = &H8000000F&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 1080
Locked = -1'True
TabIndex = 25
Text = "0"
Top = 1200
Width = 3135
End
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000080&
Height = 330
Left = 2760
Style = 2'Dropdown List
TabIndex = 23
Top = 720
Width = 1455
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 330
Left = 1080
Style = 2'Dropdown List
TabIndex = 21
Top = 720
Width = 1455
End
Begin VB.TextBox Text5
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 19
Text = "0"
Top = 240
Width = 2775
End
Begin VB.Label Label4
AutoSize = -1'True
Caption = "输出(&O):"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 1
Left = 120
TabIndex = 24
Top = 1320
Width = 810
End
Begin VB.Label Label3
AutoSize = -1'True
Caption = "到"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 1
Left = 2520
TabIndex = 22
Top = 840
Width = 195
End
Begin VB.Label Label2
AutoSize = -1'True
Caption = "单位(&S):"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 1
Left = 120
TabIndex = 20
Top = 840
Width = 810
End
Begin VB.Label Label1
AutoSize = -1'True
Caption = "输入(&I):"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 1
Left = 120
TabIndex = 18
Top = 360
Width = 810
End
End
Begin VB.CheckBox Check2
Height = 375
Left = 4080
Picture = "Form1.frx":0CCA
Style = 1'Graphical
TabIndex = 13
ToolTipText = "工具"
Top = 1080
Width = 375
End
Begin VB.Frame Frame1
Caption = "设置"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 120
TabIndex = 12
Top = 1680
Width = 4335
Begin VB.CommandButton Command2
Caption = "&R"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 16
ToolTipText = "复位"
Top = 240
Width = 375
End
Begin VB.TextBox Text4
BackColor = &H0000C0C0&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 2160
TabIndex = 15
Text = "10"
Top = 240
Width = 1335
End
Begin VB.Label Label5
AutoSize = -1'True
Caption = "位"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 1
Left = 3600
TabIndex = 27
Top = 360
Width = 195
End
Begin VB.Label Label5
AutoSize = -1'True
Caption = "小数精度(&A):小数点后"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 0
Left = 120
TabIndex = 14
Top = 360
Width = 1980
End
End
Begin VB.CheckBox Check1
Caption = "&T"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4080
Style = 1'Graphical
TabIndex = 11
ToolTipText = "窗口置顶"
Top = 600
Width = 375
End
Begin VB.CommandButton Command1
Caption = "&?"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4080
TabIndex = 10
ToolTipText = "关于"
Top = 120
Width = 375
End
Begin VB.TextBox Text3
BackColor = &H8000000F&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 960
Locked = -1'True
TabIndex = 9
Text = "0"
Top = 1080
Width = 2655
End
Begin VB.VScrollBar VScroll1
Height = 375
Index = 1
Left = 3720
Max = 36
Min = 2
TabIndex = 7
Top = 600
Value = 10
Width = 255
End
Begin VB.TextBox Text2
BackColor = &H00000080&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Index = 1
Left = 2640
TabIndex = 6
Text = "10"
Top = 600
Width = 1095
End
Begin VB.VScrollBar VScroll1
Height = 375
Index = 0
Left = 2040
Max = 36
Min = 2
TabIndex = 4
Top = 600
Value = 10
Width = 255
End
Begin VB.TextBox Text2
BackColor = &H00008000&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Index = 0
Left = 960
TabIndex = 3
Text = "10"
Top = 600
Width = 1095
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 960
TabIndex = 1
Text = "0"
Top = 120
Width = 2655
End
Begin VB.Label Label6
Alignment = 2'Center
BorderStyle = 1'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 7.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 3600
TabIndex = 26
Top = 1080
Width = 375
End
Begin VB.Label Label4
AutoSize = -1'True
Caption = "输出(&O):"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 0
Left = 120
TabIndex = 8
Top = 1200
Width = 810
End
Begin VB.Label Label3
AutoSize = -1'True
Caption = "到"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 0
Left = 2400
TabIndex = 5
Top = 720
Width = 195
End
Begin VB.Label Label2
AutoSize = -1'True
Caption = "进制(&S):"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 0
Left = 120
TabIndex = 2
Top = 720
Width = 810
End
Begin VB.Label Label1
AutoSize = -1'True
Caption = "输入(&I):"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 0
Left = 120
TabIndex = 0
Top = 240
Width = 810
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Enum sConvA
A_Bit = 0
A_Byte = 1
A_KB = 2
A_MB = 3
A_GB = 4
A_TB = 5
End Enum
Private Function CboNameToNum(name As String) As Integer
Select Case name
Case "位(bit)"
CboNameToNum = 0
Case "字节(Byte)"
CboNameToNum = 1
Case "千字节(KB)"
CboNameToNum = 2
Case "兆字节(MB)"
CboNameToNum = 3
Case "吉字节(GB)"
CboNameToNum = 4
Case "太字节(TB)"
CboNameToNum = 5
End Select
End Function
Private Function AnyToKB(ress As sConvA, inNum As Double) As Double
On Error GoTo EH_ATK:
Select Case ress
Case 0
AnyToKB = 1 / (8 * 1024) * inNum
Case 1
AnyToKB = 1 / 1024 * inNum
Case 2
AnyToKB = inNum
Case 3
AnyToKB = 1024 * inNum
Case 4
AnyToKB = 1024 ^ 2 * inNum
Case 5
AnyToKB = 1024 ^ 3 * inNum
End Select
Exit Function
EH_ATK:
AnyToKB = 0
End Function
Private Function KBToAny(ress As sConvA, inNum As Double) As Double
On Error GoTo EH_KTA:
Select Case ress
Case 0
KBToAny = 1024 * 8 * inNum
Case 1
KBToAny = 1024 * inNum
Case 2
KBToAny = inNum
Case 3
KBToAny = 1 / 1024 * inNum
Case 4
KBToAny = 1 / (1024 ^ 2) * inNum
Case 5
KBToAny = 1 / (1024 ^ 3) * inNum
End Select
Exit Function
EH_KTA:
KBToAny = "错误"
End Function
Private Function DecToAny(sScal As Integer, aCC As Long, inNum As String) As String
On Error GoTo EH_DTA:
Dim numPart() As String
Dim tMod As Long, tN As Double
Dim ts As String, ts2 As String
Dim i As Long
Dim intPart As String, floatPart As String
If Len(inNum) = 0 Then Exit Function
numPart = Split(UCase(inNum), ".")
intPart = vbNullString: tN = Val(numPart(0)): ts = vbNullString
Do
tMod = tN Mod sScal
tN = Int(tN / sScal)
ts2 = CStr(tMod)
If Len(ts2) >= 2 Then ts2 = Chr(Int(ts2) + 55)
ts = ts & ts2
Loop While tN >= 1
intPart = StrReverse(ts)
If InStr(inNum, ".") Then
floatPart = vbNullString: tN = CDbl("0." & numPart(1)): ts = vbNullString: ts2 = vbNullString
For i = 1 To aCC
If tN = Int(tN) Then Exit For
tN = tN * sScal
ts2 = CStr(Int(tN))
If Len(ts2) >= 2 Then ts2 = Chr(Int(ts2) + 55)
ts = ts & ts2
If InStr(CStr(tN), ".") Then tN = CDbl("." & Split(CStr(tN), ".")(1))
Next
floatPart = "." & ts
End If
DecToAny = intPart & floatPart
Exit Function
EH_DTA:
DecToAny = "错误"
End Function
Private Function AnyToDec(sScal As Integer, inNum As String) As String
On Error GoTo EH_ATD:
Dim numPart() As String
Dim i As Long, j As Long
Dim ts As String
Dim intPart As Long, floatPart As Double
If Len(inNum) = 0 Then Exit Function
numPart = Split(UCase(inNum), ".")
intPart = 0: j = 0
For i = Len(numPart(0)) - 1 To 0 Step -1
ts = Mid(numPart(0), i + 1, 1)
If Asc(ts) >= 65 And Asc(ts) <= 90 Then ts = CStr(Asc(ts) - 55)
intPart = intPart + sScal ^ j * Int(ts)
j = j + 1
Next
j = 0: floatPart = 0
If InStr(inNum, ".") Then
For i = 1 To Len(numPart(1))
ts = Mid(numPart(1), i, 1)
If Asc(ts) >= 65 And Asc(ts) <= 90 Then ts = CStr(Asc(ts) - 55)
floatPart = floatPart + sScal ^ -i * Int(ts)
Next
End If
AnyToDec = CStr(intPart + floatPart)
Exit Function
EH_ATD:
AnyToDec = "错误"
End Function
Private Function IsLawful(a As String, scal As Integer) As Boolean
If Asc(a) < 48 Or Asc(a) > 57 Then
If (Asc(UCase(a)) - 54) > scal Then IsLawful = False Else IsLawful = True
Else
If (Asc(a) - 47) > scal Then IsLawful = False Else IsLawful = True
End If
End Function
Private Function InFloOnly(keyNum As Integer) As Boolean
If (keyNum >= 48 And keyNum <= 57) Or keyNum = 8 Or keyNum = 16 Or keyNum = 46 Then
InFloOnly = True
Else
InFloOnly = False
End If
End Function
Private Function InIntOnly(keyNum As Integer) As Boolean
If (keyNum >= 48 And keyNum <= 57) Or keyNum = 8 Or keyNum = 16 Then
InIntOnly = True
Else
InIntOnly = False
End If
End Function
Private Function InNumOnly(keyNum As Integer) As Boolean
If (keyNum >= 48 And keyNum <= 57) Or (keyNum >= 65 And keyNum <= 90) Or (keyNum >= 97 And keyNum <= 122) Or keyNum = 45 Or keyNum = 8 Or keyNum = 16 Or keyNum = 46 Then
InNumOnly = True
Else
InNumOnly = False
End If
End Function
Private Sub Check1_Click()
If Check1.Value = 1 Then
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3
Else
SetWindowPos Me.hwnd, -2, 0, 0, 0, 0, 3
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
Me.Height = 4725
Else
Me.Height = 1965
End If
End Sub
Private Sub Combo1_Click()
Call Text5_Change
End Sub
Private Sub Combo2_Click()
Call Text5_Change
End Sub
Private Sub Command1_Click()
Dim info As String
info = "SCAL v1.0" & vbCrLf
info = info & "Copyright (C) 2013 Ctechnology Corp." & vbCrLf
info = info & "PID:201309192151A" & vbCrLf
info = info & "Created By Cyycoish" & vbCrLf
info = info & "Email:cyycoish@hotmail.com" & vbCrLf
MsgBox info, , "About SCAL"
End Sub
Private Sub Command2_Click()
Text4.Text = "10"
End Sub
Private Sub Command3_Click()
Text1.Text = "0"
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SetFocus
End Sub
Private Sub Command4_Click()
Text5.Text = "0"
Text5.SelStart = 0
Text5.SelLength = Len(Text5.Text)
Text5.SetFocus
End Sub
Private Sub Form_Load()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Me.Height = 1965
Label6.Caption = vbCrLf & Text2(1).Text
Combo1.AddItem "位(bit)"
Combo1.AddItem "字节(Byte)"
Combo1.AddItem "千字节(KB)"
Combo1.AddItem "兆字节(MB)"
Combo1.AddItem "吉字节(GB)"
Combo1.AddItem "太字节(TB)"
Combo1.Text = Combo1.List(0)
Combo2.AddItem "位(bit)"
Combo2.AddItem "字节(Byte)"
Combo2.AddItem "千字节(KB)"
Combo2.AddItem "兆字节(MB)"
Combo2.AddItem "吉字节(GB)"
Combo2.AddItem "太字节(TB)"
Combo2.Text = Combo2.List(0)
End Sub
Private Sub Text1_Change()
Dim i As Long
Dim ts As String
Dim j As Integer
j = 0
Text1.ForeColor = &H0&
For i = 1 To Len(Text1.Text)
ts = Mid(Text1.Text, i, 1)
If ts = "." Then j = j + 1
If j > 1 Then
Text1.SelStart = i - 1
Text1.SelLength = 1
Text1.ForeColor = &HFF&
Exit Sub
End If
If i <> 1 And ts = "-" Then
Text1.SelStart = i - 1
Text1.SelLength = 1
Text1.ForeColor = &HFF&
Exit Sub
End If
If IsLawful(ts, Int(Text2(0).Text)) = False Then
Text1.SelStart = i - 1
Text1.SelLength = 1
Text1.ForeColor = &HFF&
Exit Sub
End If
Next
Text3.Text = DecToAny(Int(Text2(1).Text), Int(Text4.Text), AnyToDec(Int(Text2(0).Text), Text1.Text))
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If InNumOnly(KeyAscii) = False Then KeyAscii = 0
End Sub
Private Sub Text2_Change(Index As Integer)
If Val(Text2(Index).Text) > 36 Then Text2(Index).Text = "36"
If Int(Text2(Index).Text) > 1 Then Call Text1_Change
Label6.Caption = vbCrLf & Text2(1).Text
End Sub
Private Sub Text2_KeyPress(Index As Integer, KeyAscii As Integer)
If InIntOnly(KeyAscii) = False Then KeyAscii = 0
End Sub
Private Sub Text2_LostFocus(Index As Integer)
If Val(Text2(Index).Text) < 2 Then Text2(Index).Text = "2"
If Val(Text2(Index).Text) > 36 Then Text2(Index).Text = "36"
Call Text1_Change
End Sub
Private Sub Text4_Change()
If Text4.Text = vbNullString Or Val(Text4.Text) < 1 Then Text4.Text = "1"
If Int(Text4.Text) > 1 Then Call Text1_Change
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If InIntOnly(KeyAscii) = False Then KeyAscii = 0
End Sub
Private Sub Text5_Change()
Text6.Text = KBToAny(CboNameToNum(Combo2.Text), AnyToKB(CboNameToNum(Combo1.Text), Val(Text5.Text)))
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If InFloOnly(KeyAscii) = False Then KeyAscii = 0
End Sub
Private Sub VScroll1_Change(Index As Integer)
Text2(Index).Text = VScroll1(Index).Value
End Sub
浏览器bug,我发不了图了,大家把代码弄到frm文件中即可运行 补充一句,这个可以算小数 补充一句你这个只能在Windows上运行哦。 回复有宅币吗
页:
[1]