1、2) 3) Sub page_load() 页面加载4) If Not (Page.IsPostBack) Then 首次加载页面,给输出屏幕赋值5) shuchu.Text = 06) jz16.Text = 7) jz8.Text = 8) jz2.Text = 9) jc.Text = 10) zt.Text = 11) End If12) jc2.Text = 13) End Sub14) 15) Public Function jinzhi() 进制转换函数16) jc2.Text = Val(shuchu.Text) 16进制转换17) jz16.Text = 18) Do Whi
2、le Val(jc2.Text) 019) Select Case CStr(Val(jc2.Text) Mod 16)20) Case 1021) jz16.Text = A & jz16.Text22) Case 1123) jz16.Text = B24) Case 1225) jz16.Text = C26) Case 1327) jz16.Text = D28) Case 1429) jz16.Text = E30) Case 1531) jz16.Text = F32) Case Else33) jz16.Text = Val(jc2.Text Mod 16) &34) End S
3、elect35) jc2.Text = Str(Val(jc2.Text) 16)36) Loop37) 38) jc2.Text = Val(shuchu.Text) 8进制转换39) jz8.Text = 40) Do While Val(jc2.Text) 41) jz8.Text = (Val(jc2.Text) Mod 8) & jz8.Text42) jc2.Text = Str(Val(jc2.Text) 8)43) Loop44) 45) jc2.Text = Val(shuchu.Text) 2进制转换46) jz2.Text = 47) Do While Val(jc2.T
4、ext) 48) jz2.Text = (Val(jc2.Text) Mod 2) & jz2.Text49) jc2.Text = Str(Val(jc2.Text) 2)50) Loop51) jc2.Text = 52) 53) If shuchu.Text = 0 Then 如果当前值为“0”54) jz16.Text = 055) jz8.Text = 056) jz2.Text = 057) End If58) End Function59) 60) Protected Sub zero_Click(ByVal sender As Object, ByVal e As System
5、.EventArgs) 单击“0”按钮时61) If shuchu.Text Then 如果当前输出为非“0”,则在字符串右边加上“0”62) shuchu.Text = shuchu.Text &63) ElseIf shuchu.Text = 如果当前输出为“0”,则不在字符串右边加“0”64) shuchu.Text = 065) End If66) jinzhi() 调用进制转换函数67) End Sub68) 69) Protected Sub one_Click(ByVal sender As Object, ByVal e As System.EventArgs) 单机“1”按钮
6、时70) If shuchu.Text 如果当前输出为非“0”,则在字符串右边加上“1”71) shuchu.Text = shuchu.Text & 172) End If73) If shuchu.Text = 如果当前输出为“0”,则直接赋值输出“1”74) shuchu.Text = 175) End If76) jinzhi() 77) End Sub78) 79) Protected Sub two_Click(ByVal sender As Object, ByVal e As System.EventArgs) 同上80) If shuchu.Text Then81) shuc
7、hu.Text = shuchu.Text & 282) End If83) If shuchu.Text = 84) shuchu.Text = 285) End If86) jinzhi()87) End Sub88) 89) Protected Sub three_Click(ByVal sender As Object, ByVal e As System.EventArgs) 90) If shuchu.Text 91) shuchu.Text = shuchu.Text & 392) End If93) If shuchu.Text = 94) shuchu.Text = 395)
8、 End If96) jinzhi()97) End Sub98) 99) Protected Sub four_Click(ByVal sender As Object, ByVal e As System.EventArgs) 100) If shuchu.Text 101) shuchu.Text = shuchu.Text & 4102) End If103) If shuchu.Text = 104) shuchu.Text = 4105) End If106) jinzhi()107) End Sub108) 109) Protected Sub five_Click(ByVal
9、sender As Object, ByVal e As System.EventArgs) 110) If shuchu.Text 111) shuchu.Text = shuchu.Text & 5112) End If113) If shuchu.Text = 114) shuchu.Text = 5115) End If116) jinzhi()117) End Sub118) 119) Protected Sub six_Click(ByVal sender As Object, ByVal e As System.EventArgs) 120) If shuchu.Text 121
10、) shuchu.Text = shuchu.Text & 6122) End If123) If shuchu.Text = 124) shuchu.Text = 6125) End If126) jinzhi()127) End Sub128) 129) Protected Sub seven_Click(ByVal sender As Object, ByVal e As System.EventArgs) 130) If shuchu.Text 131) shuchu.Text = shuchu.Text & 7132) End If133) If shuchu.Text = 134)
11、 shuchu.Text = 7135) End If136) jinzhi()137) End Sub138) 139) Protected Sub eight_Click(ByVal sender As Object, ByVal e As System.EventArgs) 140) If shuchu.Text 141) shuchu.Text = shuchu.Text & 8142) End If143) If shuchu.Text = 144) shuchu.Text = 8145) End If146) jinzhi()147) End Sub148) 149) Protec
12、ted Sub nine_Click(ByVal sender As Object, ByVal e As System.EventArgs) 150) If shuchu.Text 151) shuchu.Text = shuchu.Text & 9152) End If153) If shuchu.Text = 154) shuchu.Text = 9155) End If156) jinzhi()157) End Sub158) 159) Protected Sub dot_Click(ByVal sender As Object, ByVal e As System.EventArgs
13、) 单击“.”按钮时160) If Val(shuchu.Text) Mod 1 0 Then 如果当前屏幕输出数值为小数,则不修改任何属性161) End If162) If Val(shuchu.Text) Mod 1 = 0 Then 如果当前屏幕输出数值为整数,则在字符串的右边加上“.”163) shuchu.Text = shuchu.Text &.164) End If165) jinzhi()166) End Sub167) 168) Protected Sub clean_Click(ByVal sender As Object, ByVal e As System.Event
14、Args) 单击“C”按钮时169) shuchu.Text = 0 主屏幕输出数值归零170) jc.Text = 清除寄存数值171) zt.Text = 清除当前计算状态172) jz16.Text = 0173) jz8.Text = 0174) jz2.Text = 0175) End Sub176) 177) Protected Sub eq_Click(ByVal sender As Object, ByVal e As System.EventArgs) 单击“”按钮时178) Select Case (zt.Text)179) Case 当前计算状态为加法,把当前主屏幕数值和
15、寄存器内数值“相加”,并由主屏幕输出180) shuchu.Text = Str(Val(jc.Text) + Val(shuchu.Text)181) Case 当前计算状态为“减法”,把当前主屏幕数值和寄存器内数值“相减”,并由主屏幕输出182) shuchu.Text = Str(Val(jc.Text) - Val(shuchu.Text)183) Case 当前计算状态为“乘法”,把当前主屏幕数值和寄存器内数值“相乘”,并由主屏幕输出184) shuchu.Text = Str(Val(jc.Text) * Val(shuchu.Text)185) Case 当前计算状态为“除法”,
16、把当前主屏幕数值和寄存器内数值“相除”,并由主屏幕输出186) shuchu.Text = Str(Val(jc.Text) / Val(shuchu.Text)187) Case 当前计算状态为“求余”,把当前主屏幕数值和寄存器内数值“求余”,并由主屏幕输出188) shuchu.Text = Str(Val(jc.Text) Mod Val(shuchu.Text)189) Case xy当前计算状态为“X分之一”,把当前主屏幕数值和寄存器内数值“X分之一”,并由主屏幕输出190) shuchu.Text = Str(Val(jc.Text) Val(shuchu.Text)191) En
17、d Select192) shuchu.Text = Val(shuchu.Text)193) jinzhi()194) End Sub195) 196) Protected Sub subtract_Click(ByVal sender As Object, ByVal e As System.EventArgs) 当单击“”按钮时197) jc.Text = Val(shuchu.Text) 把当前主数值存入寄存器198) zt.Text = 更改状态为“”199) shuchu.Text = 0 主屏幕清零200) jinzhi()201) End Sub202) 203) Protec
18、ted Sub plus_Click(ByVal sender As Object, ByVal e As System.EventArgs) 同上204) jc.Text = Val(shuchu.Text)205) zt.Text = 206) shuchu.Text = 0207) jinzhi()208) End Sub209) 210) Protected Sub multiply_Click(ByVal sender As Object, ByVal e As System.EventArgs) 211) jc.Text = Val(shuchu.Text)212) zt.Text
19、 = 213) shuchu.Text = 0214) jinzhi()215) End Sub216) 217) Protected Sub divide_Click(ByVal sender As Object, ByVal e As System.EventArgs) 218) jc.Text = Val(shuchu.Text)219) zt.Text = 220) shuchu.Text = 0221) jinzhi()222) End Sub223) 224) Protected Sub qiuyu_Click(ByVal sender As Object, ByVal e As
20、System.EventArgs) 225) jc.Text = Val(shuchu.Text)226) zt.Text = 227) shuchu.Text = 0228) jinzhi()229) End Sub230) 231) Protected Sub xy_Click(ByVal sender As Object, ByVal e As System.EventArgs) 232) jc.Text = Val(shuchu.Text)233) zt.Text = 234) shuchu.Text = 0235) jinzhi()236) End Sub237) 238) Prot
21、ected Sub pai_Click(ByVal sender As Object, ByVal e As System.EventArgs) 单击“”按钮时239) shuchu.Text = 3.1415926 给主屏幕数值赋值并输出240) jinzhi()241) End Sub242) 243) Protected Sub x2_Click(ByVal sender As Object, ByVal e As System.EventArgs) 单击“x2”按钮时244) jc.Text = Val(shuchu.Text) 主数值放入寄存器245) zt.Text = x2更改计
22、算状态为“x2”246) shuchu.Text = Str(Val(jc.Text) 2) 计算“x2”247) jinzhi()248) End Sub249) 250) Protected Sub x3_Click(ByVal sender As Object, ByVal e As System.EventArgs) 251) jc.Text = Val(shuchu.Text)252) zt.Text = x3253) shuchu.Text = Str(Val(jc.Text) 3)254) jinzhi()255) End Sub256) 257) Protected Sub x
23、1_Click(ByVal sender As Object, ByVal e As System.EventArgs) 单击“1/x”按钮时258) jc.Text = Val(shuchu.Text) 259) zt.Text = 1/x更改计算状态为“1/x”260) shuchu.Text = Str(1 / Val(jc.Text) 计算“1/x”261) shuchu.Text = Val(shuchu.Text)262) jinzhi()263) End Sub264) 265) Protected Sub backspace_Click(ByVal sender As Obje
24、ct, ByVal e As System.EventArgs) 单击“”按钮时266) If Val(shuchu.Text) / 1.1 若当前主屏幕输出数值不为个位数,则减去最右边的一位267) shuchu.Text = Left(shuchu.Text, Len(shuchu.Text) - 1)268) End If269) If Val(shuchu.Text) / 1.1 = 0 Then 若当前主屏幕输出数值为个位数,则清零主屏幕输出数值270) shuchu.Text = 0271) End If272) jinzhi()273) End Sub274) 275) 网页代码
25、(无注释):html xmlns=http:/www.w3.org/1999/xhtmlhead3) JVTC NET0856 HP 2011/12/07 Shadow4) style type=text/css5) table#js 6) margin:0px;7) padding:8) background-color:#aaaaaa;9) 10) td 11) padding:3px;12) 13) .button 14) width:70px;15) height:50px;16) font-size:32px;17) color:#eeeeee;18) background-color:#111111;19) 20) 21) 22) body style=text-align:center; background-color:#333333; margin-top: font-family:Arial;23) form id=Form1 action=# runat=24) table id=js25) 26) td colspan=527) table style=height:110px; Width:100%;#222222;28) 29) 2/td30) td colsp
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1