根据各位的提示捣鼓的成品,目前发现是Group不能直接一次设置为显示/隐藏,另外Combox高度设置好像无效?
变量定义的时候有点麻烦,实际上可以用$Rdo[10][3]这种,不过会过意来的时候已经成屎山了,懒得改了...#region AutoIt3Wrapper 预编译参数(常用参数)
#AutoIt3Wrapper_Icon=F:\AU3脚本\图标\hidao.ico ;图标,支持EXE,DLL,ICO
#AutoIt3Wrapper_OutFile=R_Calc.exe ;输出文件名
#AutoIt3Wrapper_OutFile_Type=exe ;文件类型
#AutoIt3Wrapper_Compression=9 ;压缩等级
#AutoIt3Wrapper_UseUPX=y ;使用压缩
#AutoIt3Wrapper_Res_Comment=R_Calc ;注释
#AutoIt3Wrapper_Res_Description=电阻计算器;详细信息
#AutoIt3Wrapper_Res_Fileversion=0.1.2023.910
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=;p ;自动更新版本
#AutoIt3Wrapper_Res_LegalCopyright=邪恶海盗;版权
#endregion AutoIt3Wrapper 预编译参数(常用参数)
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
#region ### START Koda GUI section ### Form=f:\au3脚本\色环电阻.kxf
Dim $Radio1[10], $Radio2[10], $Radio3[10], $Radio4[10], $Radio5[8], $Radio6[8], $i1 = 0, $i2 = 0, $i3 = 0, $i4 = 0, $i5 = 0, $i6 = 0
Dim $Rdo1_3[10] = ['黑=0', '棕=1', '红=2', '橙=3', '黄=4', '绿=5', '蓝=6', '紫=7', '灰=8', '白=9']
Dim $Rdo1_3L[10] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
Dim $Color1_3[10] = [0x000000, 0x800000, 0xFF0000, 0xFFA500, 0xFFFF00, 0x008000, 0x0000FF, 0x800080, 0x808080, 0xFFFFFF]
Dim $Rdo4[10] = ['黑=0', '棕=1', '红=2', '橙=3', '黄=4', '绿=5', '蓝=6', '紫=7', '金=-1', '银=-2']
Dim $Rdo4L[10] = ['0', '1', '2', '3', '4', '5', '6', '7', '-1', '-2']
Dim $Color4[10] = [0x000000, 0x800000, 0xFF0000, 0xFFA500, 0xFFFF00, 0x008000, 0x0000FF, 0x800080, 0xFFD700, 0xC0C0C0]
Dim $Rdo5[8] = ['棕=±1', '红=±2', '绿=±0.5', '蓝=±0.25', '紫=±0.1', '灰=±0.05', '金=±5', '银=±10']
Dim $Rdo5L[8] = ['±1', '±2', '±0.5', '±0.25', '±0.1', '±0.05', '±5', '±10']
Dim $Color5[8] = [0x800000, 0xFF0000, 0x008000, 0x0000FF, 0x800080, 0x808080, 0xFFD700, 0xC0C0C0]
Dim $Rdo6[6] = ['棕=100ppm', '红=50ppm', '橙=15ppm', '黄=25ppm', '蓝=10ppm', '紫=5ppm']
Dim $Rdo6L[6] = ['100ppm/℃', '50ppm/℃', '15ppm/℃', '25ppm/℃', '10ppm/℃', '5ppm/℃']
Dim $Color6[6] = [0x800000, 0xFF0000, 0xFFA500, 0xFFFF00, 0x0000FF, 0x800080]
$Form1_1 = GUICreate("电阻计算器 v0.1 20230910", 535, 365)
$oeminfo = GUICtrlCreateLabel('邪恶海盗 www.hidao.org', 375, 1, 160, 18, $SS_CENTERIMAGE)
GUICtrlSetFont(-1, 10)
GUICtrlSetColor(-1, 0x0000FF)
$Tab1 = GUICtrlCreateTab(0, 0, 535, 365)
$TabSheet1 = GUICtrlCreateTabItem("色环转阻值")
$Radio30 = GUICtrlCreateRadio("3环电阻", 10, 30, 70, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio40 = GUICtrlCreateRadio("4环电阻", 10, 55, 70, 25)
$Radio50 = GUICtrlCreateRadio("5环电阻", 85, 30, 70, 25)
$Radio60 = GUICtrlCreateRadio("6环电阻", 85, 55, 70, 25)
GUICtrlCreateLabel(" ", 165, 54, 10, 2, $SS_ETCHEDHORZ)
GUICtrlCreateLabel(" ", 170, 35, 125, 40, $SS_GRAYFRAME)
GUICtrlCreateLabel(" ", 293, 54, 10, 2, $SS_ETCHEDHORZ)
$Label01 = GUICtrlCreateLabel(" ", 185, 34, 10, 42, $SS_SUNKEN)
GUICtrlSetBkColor(-1, $Color1_3[0])
$Label02 = GUICtrlCreateLabel(" ", 200, 34, 10, 42, $SS_SUNKEN)
GUICtrlSetBkColor(-1, $Color1_3[0])
$Label03 = GUICtrlCreateLabel(" ", 215, 34, 10, 42, $SS_SUNKEN)
GUICtrlSetBkColor(-1, $Color1_3[0])
$Label04 = GUICtrlCreateLabel(" ", 230, 34, 10, 42, $SS_SUNKEN)
GUICtrlSetBkColor(-1, $Color4[0])
$Label05 = GUICtrlCreateLabel(" ", 255, 34, 10, 42, $SS_SUNKEN)
GUICtrlSetBkColor(-1, $Color5[0])
$Label06 = GUICtrlCreateLabel(" ", 270, 34, 10, 42, $SS_SUNKEN)
GUICtrlSetBkColor(-1, $Color6[0])
GUICtrlSetState($Label03, $GUI_HIDE)
GUICtrlSetState($Label05, $GUI_HIDE)
GUICtrlSetState($Label06, $GUI_HIDE)
$Lab1 = GUICtrlCreateLabel("计算过程及结果", 305, 25, 220, 25, $SS_SUNKEN + $SS_CENTERIMAGE)
;GUICtrlSetFont(-1,10)
$Lab2 = GUICtrlCreateLabel("计算过程及结果", 305, 50, 220, 25, $SS_SUNKEN + $SS_CENTERIMAGE)
GUICtrlSetFont(-1, 10)
$Group1 = GUICtrlCreateGroup("第1位", 10, 85, 70, 270)
GUICtrlSetFont(-1, 9)
For $Rn1 = 0 To 9
$Radio1[$Rn1] = GUICtrlCreateRadio($Rdo1_3[$Rn1], 15, 100 + 25 * $Rn1, 60, 25)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $Color1_3[$Rn1])
Next
GUICtrlSetColor($Radio1[4], 0x000000)
GUICtrlSetColor($Radio1[9], 0x000000)
GUICtrlSetState($Radio1[0], $GUI_CHECKED)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("第2位", 85, 85, 70, 270)
GUICtrlSetFont(-1, 9)
For $Rn2 = 0 To 9
$Radio2[$Rn2] = GUICtrlCreateRadio($Rdo1_3[$Rn2], 90, 100 + 25 * $Rn2, 60, 25)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $Color1_3[$Rn2])
Next
GUICtrlSetColor($Radio2[4], 0x000000)
GUICtrlSetColor($Radio2[9], 0x000000)
GUICtrlSetState($Radio2[0], $GUI_CHECKED)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("第3位", 160, 85, 70, 270)
GUICtrlSetFont(-1, 9)
For $Rn3 = 0 To 9
$Radio3[$Rn3] = GUICtrlCreateRadio($Rdo1_3[$Rn3], 165, 100 + 25 * $Rn3, 60, 25)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $Color1_3[$Rn3])
Next
GUICtrlSetColor($Radio3[4], 0x000000)
GUICtrlSetColor($Radio3[9], 0x000000)
GUICtrlSetState($Radio3[0], $GUI_CHECKED)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("倍率(10^n)", 235, 85, 80, 270)
GUICtrlSetFont(-1, 9)
For $Rn4 = 0 To 9
$Radio4[$Rn4] = GUICtrlCreateRadio($Rdo4[$Rn4], 240, 100 + 25 * $Rn4, 70, 25)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $Color4[$Rn4])
Next
GUICtrlSetColor($Radio4[4], 0x000000)
GUICtrlSetState($Radio4[0], $GUI_CHECKED)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group5 = GUICtrlCreateGroup("误差(%)", 320, 85, 100, 270)
GUICtrlSetFont(-1, 9)
For $Rn5 = 0 To 7
$Radio5[$Rn5] = GUICtrlCreateRadio($Rdo5[$Rn5], 325, 100 + 25 * $Rn5, 90, 25)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $Color5[$Rn5])
Next
GUICtrlSetState($Radio5[0], $GUI_CHECKED)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group6 = GUICtrlCreateGroup("温度系数(/℃)", 425, 85, 100, 270)
GUICtrlSetFont(-1, 9)
For $Rn6 = 0 To 5
$Radio6[$Rn6] = GUICtrlCreateRadio($Rdo6[$Rn6], 430, 100 + 25 * $Rn6, 90, 25)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $Color6[$Rn6])
Next
GUICtrlSetColor($Radio6[3], 0x000000)
GUICtrlSetState($Radio6[0], $GUI_CHECKED)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState($Group3, $GUI_HIDE)
For $Radio_30 In $Radio3
GUICtrlSetState($Radio_30, $GUI_HIDE)
Next
GUICtrlSetState($Group5, $GUI_HIDE)
For $Radio_50 In $Radio5
GUICtrlSetState($Radio_50, $GUI_HIDE)
Next
GUICtrlSetState($Group6, $GUI_HIDE)
For $Radio_60 In $Radio6
GUICtrlSetState($Radio_60, $GUI_HIDE)
Next
$TabSheet4 = GUICtrlCreateTabItem("串并联阻值计算")
;GUICtrlSetState(-1, $GUI_SHOW)
$Group7 = GUICtrlCreateGroup("串联阻值计算", 10, 35, 505, 95)
$InputR11 = GUICtrlCreateInput("", 24, 55, 50, 25)
$Combo11 = GUICtrlCreateCombo("", 74, 55, 50, 25)
GUICtrlSetData(-1, "Ω|KΩ|MΩ", 'Ω')
$InputR12 = GUICtrlCreateInput("", 144, 55, 50, 25)
$Combo12 = GUICtrlCreateCombo("", 194, 55, 50, 25)
GUICtrlSetData(-1, "Ω|KΩ|MΩ", 'Ω')
$InputR13 = GUICtrlCreateInput("?", 294, 55, 100, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$ButtonR1 = GUICtrlCreateButton("计算", 424, 54, 65, 25)
$InputR21 = GUICtrlCreateInput("", 22, 95, 50, 25)
$Combo21 = GUICtrlCreateCombo("", 72, 95, 50, 25)
GUICtrlSetData(-1, "Ω|KΩ|MΩ", 'Ω')
$InputR22 = GUICtrlCreateInput("?", 144, 95, 100, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$InputR23 = GUICtrlCreateInput("", 294, 95, 50, 25)
$Combo23 = GUICtrlCreateCombo("", 344, 95, 50, 25)
GUICtrlSetData(-1, "Ω|KΩ|MΩ", 'Ω')
$ButtonR2 = GUICtrlCreateButton("计算", 425, 94, 65, 25)
GUICtrlCreateLabel("=", 254, 55, 25, 25, $SS_CENTER + $SS_CENTERIMAGE)
GUICtrlCreateLabel("=", 254, 97, 25, 25, $SS_CENTER + $SS_CENTERIMAGE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group8 = GUICtrlCreateGroup("并联阻值计算", 10, 140, 505, 95)
$InputR31 = GUICtrlCreateInput("", 24, 160, 50, 25)
$Combo31 = GUICtrlCreateCombo("", 74, 161, 50, 25)
GUICtrlSetData(-1, "Ω|KΩ|MΩ", 'Ω')
$InputR32 = GUICtrlCreateInput("", 144, 161, 50, 25)
$Combo32 = GUICtrlCreateCombo("", 194, 161, 50, 25)
GUICtrlSetData(-1, "Ω|KΩ|MΩ", 'Ω')
GUICtrlCreateLabel("=", 254, 163, 25, 25, $SS_CENTER + $SS_CENTERIMAGE)
$InputR33 = GUICtrlCreateInput("?", 294, 161, 100, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$ButtonR3 = GUICtrlCreateButton("计算", 424, 160, 65, 25)
$InputR41 = GUICtrlCreateInput("", 24, 200, 50, 25)
$Combo41 = GUICtrlCreateCombo(" ", 74, 200, 50, 25)
GUICtrlSetData(-1, "Ω|KΩ|MΩ", 'Ω')
$InputR42 = GUICtrlCreateInput("?", 144, 200, 100, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel("=", 254, 202, 25, 25, $SS_CENTER + $SS_CENTERIMAGE)
$InputR43 = GUICtrlCreateInput("", 294, 200, 50, 25)
$Combo43 = GUICtrlCreateCombo("", 344, 200, 50, 25)
GUICtrlSetData(-1, "Ω|KΩ|MΩ", 'Ω')
$ButtonR4 = GUICtrlCreateButton("计算", 424, 199, 65, 25)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $oeminfo
ShellExecute('www.hidao.org')
Case $Radio30
GUICtrlSetState($Label03, $GUI_HIDE)
GUICtrlSetState($Label04, $GUI_SHOW)
GUICtrlSetState($Label05, $GUI_HIDE)
GUICtrlSetState($Label06, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_HIDE)
For $Radio_30 In $Radio3
GUICtrlSetState($Radio_30, $GUI_HIDE)
Next
GUICtrlSetState($Group4, $GUI_SHOW)
For $Radio_40 In $Radio4
GUICtrlSetState($Radio_40, $GUI_SHOW)
Next
GUICtrlSetState($Group5, $GUI_HIDE)
For $Radio_50 In $Radio5
GUICtrlSetState($Radio_50, $GUI_HIDE)
Next
GUICtrlSetState($Group6, $GUI_HIDE)
For $Radio_60 In $Radio6
GUICtrlSetState($Radio_60, $GUI_HIDE)
Next
_Calc()
Case $Radio40
GUICtrlSetState($Label03, $GUI_HIDE)
GUICtrlSetState($Label04, $GUI_SHOW)
GUICtrlSetState($Label05, $GUI_SHOW)
GUICtrlSetState($Label06, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_HIDE)
For $Radio_30 In $Radio3
GUICtrlSetState($Radio_30, $GUI_HIDE)
Next
GUICtrlSetState($Group4, $GUI_SHOW)
For $Radio_40 In $Radio4
GUICtrlSetState($Radio_40, $GUI_SHOW)
Next
GUICtrlSetState($Group5, $GUI_SHOW)
For $Radio_50 In $Radio5
GUICtrlSetState($Radio_50, $GUI_SHOW)
Next
GUICtrlSetState($Group6, $GUI_HIDE)
For $Radio_60 In $Radio6
GUICtrlSetState($Radio_60, $GUI_HIDE)
Next
_Calc()
Case $Radio50
GUICtrlSetState($Label03, $GUI_SHOW)
GUICtrlSetState($Label04, $GUI_SHOW)
GUICtrlSetState($Label05, $GUI_SHOW)
GUICtrlSetState($Label06, $GUI_HIDE)
GUICtrlSetState($Group3, $GUI_SHOW)
For $Radio_30 In $Radio3
GUICtrlSetState($Radio_30, $GUI_SHOW)
Next
GUICtrlSetState($Group4, $GUI_SHOW)
For $Radio_40 In $Radio4
GUICtrlSetState($Radio_40, $GUI_SHOW)
Next
GUICtrlSetState($Group5, $GUI_SHOW)
For $Radio_50 In $Radio5
GUICtrlSetState($Radio_50, $GUI_SHOW)
Next
GUICtrlSetState($Group6, $GUI_HIDE)
For $Radio_60 In $Radio6
GUICtrlSetState($Radio_60, $GUI_HIDE)
Next
_Calc()
Case $Radio60
GUICtrlSetState($Label03, $GUI_SHOW)
GUICtrlSetState($Label04, $GUI_SHOW)
GUICtrlSetState($Label05, $GUI_SHOW)
GUICtrlSetState($Label06, $GUI_SHOW)
GUICtrlSetState($Group3, $GUI_SHOW)
For $Radio_30 In $Radio3
GUICtrlSetState($Radio_30, $GUI_SHOW)
Next
GUICtrlSetState($Group4, $GUI_SHOW)
For $Radio_40 In $Radio4
GUICtrlSetState($Radio_40, $GUI_SHOW)
Next
GUICtrlSetState($Group5, $GUI_SHOW)
For $Radio_50 In $Radio5
GUICtrlSetState($Radio_50, $GUI_SHOW)
Next
GUICtrlSetState($Group6, $GUI_SHOW)
For $Radio_60 In $Radio6
GUICtrlSetState($Radio_60, $GUI_SHOW)
Next
_Calc()
Case $Radio1[0] To $Radio1[9]
$i1 = $nMsg - $Radio1[0]
;GUICtrlSetData($Label01,$Rdo1_3L[$i1])
GUICtrlSetBkColor($Label01, $Color1_3[$i1])
GUICtrlSetBkColor($Label02, $Color1_3[$i2])
GUICtrlSetBkColor($Label03, $Color1_3[$i3])
GUICtrlSetBkColor($Label04, $Color4[$i4])
GUICtrlSetBkColor($Label05, $Color5[$i5])
GUICtrlSetBkColor($Label06, $Color6[$i6])
;MsgBox(0, '', $i1)
_calc()
Case $Radio2[0] To $Radio2[9]
$i2 = $nMsg - $Radio2[0]
GUICtrlSetBkColor($Label01, $Color1_3[$i1])
GUICtrlSetBkColor($Label02, $Color1_3[$i2])
GUICtrlSetBkColor($Label03, $Color1_3[$i3])
GUICtrlSetBkColor($Label04, $Color4[$i4])
GUICtrlSetBkColor($Label05, $Color5[$i5])
GUICtrlSetBkColor($Label06, $Color6[$i6])
;MsgBox(0, '', $i2)
_calc()
Case $Radio3[0] To $Radio3[9]
$i3 = $nMsg - $Radio3[0]
GUICtrlSetBkColor($Label01, $Color1_3[$i1])
GUICtrlSetBkColor($Label02, $Color1_3[$i2])
GUICtrlSetBkColor($Label03, $Color1_3[$i3])
GUICtrlSetBkColor($Label04, $Color4[$i4])
GUICtrlSetBkColor($Label05, $Color5[$i5])
GUICtrlSetBkColor($Label06, $Color6[$i6])
;MsgBox(0, '', $i3)
_calc()
Case $Radio4[0] To $Radio4[9]
$i4 = $nMsg - $Radio4[0]
GUICtrlSetBkColor($Label01, $Color1_3[$i1])
GUICtrlSetBkColor($Label02, $Color1_3[$i2])
GUICtrlSetBkColor($Label03, $Color1_3[$i3])
GUICtrlSetBkColor($Label04, $Color4[$i4])
GUICtrlSetBkColor($Label05, $Color5[$i5])
GUICtrlSetBkColor($Label06, $Color6[$i6])
;MsgBox(0, '', $i4)
_calc()
Case $Radio5[0] To $Radio5[7]
$i5 = $nMsg - $Radio5[0]
GUICtrlSetBkColor($Label01, $Color1_3[$i1])
GUICtrlSetBkColor($Label02, $Color1_3[$i2])
GUICtrlSetBkColor($Label03, $Color1_3[$i3])
GUICtrlSetBkColor($Label04, $Color4[$i4])
GUICtrlSetBkColor($Label05, $Color5[$i5])
GUICtrlSetBkColor($Label06, $Color6[$i6])
;MsgBox(0, '', $i5)
_calc()
Case $Radio6[0] To $Radio6[5]
$i6 = $nMsg - $Radio6[0]
GUICtrlSetBkColor($Label01, $Color1_3[$i1])
GUICtrlSetBkColor($Label02, $Color1_3[$i2])
GUICtrlSetBkColor($Label03, $Color1_3[$i3])
GUICtrlSetBkColor($Label04, $Color4[$i4])
GUICtrlSetBkColor($Label05, $Color5[$i5])
GUICtrlSetBkColor($Label06, $Color6[$i6])
;MsgBox(0, '', $i6)
_calc()
Case $ButtonR1
; $ComboR3=GUICtrlRead($Combo13)
Switch GUICtrlRead($Combo11)
Case 'Ω'
$R11 = GUICtrlRead($InputR11)
Case "KΩ"
$R11 = GUICtrlRead($InputR11) * 1000
Case "MΩ"
$R11 = GUICtrlRead($InputR11) * 1000000
EndSwitch
Switch GUICtrlRead($Combo12)
Case 'Ω'
$R12 = GUICtrlRead($InputR12)
Case 'KΩ'
$R12 = GUICtrlRead($InputR12) * 1000
Case 'MΩ'
$R12 = GUICtrlRead($InputR12) * 1000000
EndSwitch
Switch $R11 + $R12
Case $R11 + $R12 < 999
;$R13=$R11+$R12
GUICtrlSetData($InputR13, Round($R11 + $R12, 1) & ' Ω')
Case 1000 To 999999
GUICtrlSetData($InputR13, Round(($R11 + $R12) / 1000, 1) & " KΩ")
Case Else
GUICtrlSetData($InputR13, Round(($R11 + $R12) / 1000000, 1) & " MΩ")
EndSwitch
;GUICtrlSetData($InputR13,GUICtrlRead($InputR11)+GUICtrlRead($InputR12))
Case $ButtonR2
Switch GUICtrlRead($Combo21)
Case 'Ω'
$R21 = GUICtrlRead($InputR21)
Case "KΩ"
$R21 = GUICtrlRead($InputR21) * 1000
Case "MΩ"
$R21 = GUICtrlRead($InputR21) * 1000000
EndSwitch
Switch GUICtrlRead($Combo23)
Case 'Ω'
$R23 = GUICtrlRead($InputR23)
Case 'KΩ'
$R23 = GUICtrlRead($InputR23) * 1000
Case 'MΩ'
$R23 = GUICtrlRead($InputR23) * 1000000
EndSwitch
Switch $R23 - $R21
Case $R23 - $R21 < 999
;$R13=$R11+$R12
GUICtrlSetData($InputR22, Round($R23 - $R21, 1) & ' Ω')
Case 1000 To 999999
GUICtrlSetData($InputR22, Round(($R23 - $R21) / 1000, 1) & " KΩ")
Case Else
GUICtrlSetData($InputR22, Round(($R23 - $R21) / 1000000, 1) & " MΩ")
EndSwitch
Case $ButtonR3
Switch GUICtrlRead($Combo31)
Case 'Ω'
$R31 = GUICtrlRead($InputR31)
Case "KΩ"
$R31 = GUICtrlRead($InputR31) * 1000
Case "MΩ"
$R31 = GUICtrlRead($InputR31) * 1000000
EndSwitch
Switch GUICtrlRead($Combo32)
Case 'Ω'
$R32 = GUICtrlRead($InputR32)
Case 'KΩ'
$R32 = GUICtrlRead($InputR32) * 1000
Case 'MΩ'
$R32 = GUICtrlRead($InputR32) * 1000000
EndSwitch
Switch ($R31 * $R32) / ($R31 + $R32)
Case ($R31 * $R32) / ($R31 + $R32) < 999
;$R13=$R11+$R12
GUICtrlSetData($InputR33, Round(($R31 * $R32) / ($R31 + $R32), 1) & ' Ω')
Case 1000 To 999999
GUICtrlSetData($InputR33, Round((($R31 * $R32) / ($R31 + $R32)) / 1000, 1) & " KΩ")
Case Else
GUICtrlSetData($InputR33, Round((($R31 * $R32) / ($R31 + $R32)) / 1000000, 1) & " MΩ")
EndSwitch
Case $ButtonR4
Switch GUICtrlRead($Combo41)
Case 'Ω'
$R41 = GUICtrlRead($InputR41)
Case "KΩ"
$R41 = GUICtrlRead($InputR41) * 1000
Case "MΩ"
$R41 = GUICtrlRead($InputR41) * 1000000
EndSwitch
Switch GUICtrlRead($Combo43)
Case 'Ω'
$R43 = GUICtrlRead($InputR43)
Case 'KΩ'
$R43 = GUICtrlRead($InputR43) * 1000
Case 'MΩ'
$R43 = GUICtrlRead($InputR43) * 1000000
EndSwitch
Switch ($R41 * $R43) / ($R41 - $R43)
Case ($R41 * $R43) / ($R41 - $R43) < 999
;$R13=$R11+$R12
GUICtrlSetData($InputR42, Round(($R41 * $R43) / ($R41 - $R43), 1) & ' Ω')
Case 1000 To 999999
GUICtrlSetData($InputR42, Round(($R41 * $R43) / ($R41 - $R43) / 1000, 1) & " KΩ")
Case Else
GUICtrlSetData($InputR42, Round(($R41 * $R43) / ($R41 - $R43) / 1000000, 1) & " MΩ")
EndSwitch
EndSwitch
WEnd
Func _Calc()
If GUICtrlRead($Radio30) = $GUI_CHECKED Then
$Var1 = ' ' & $Rdo1_3L[$i1] & ' ' & $Rdo1_3L[$i2] & ' ×10^' & $Rdo4L[$i4] & " = "
$Var2 = ($Rdo1_3L[$i1] & $Rdo1_3L[$i2]) * 10 ^ $Rdo4L[$i4]
$Var3 = '(误差:' & '±20' & '%)'
;GUICtrlSetData($Label1, ' ' & $i1 & ' ' & $i2 & ' ×10^' & $i4 & " = " & ($i1 & $i2) * 10 ^ $i4 & " Ω" & ' (误差:' & '20%' & ')')
EndIf
If GUICtrlRead($Radio40) = $GUI_CHECKED Then
$Var1 = ' ' & $Rdo1_3L[$i1] & ' ' & $Rdo1_3L[$i2] & ' ×10^' & $Rdo4L[$i4] & " = "
$Var2 = ($Rdo1_3L[$i1] & $Rdo1_3L[$i2]) * 10 ^ $Rdo4L[$i4]
$Var3 = '(误差:' & $Rdo5L[$i5] & '%)'
;GUICtrlSetData($Label1, ' ' & $i1 & ' ' & $i2 & ' ×10^' & $i4 & " = " & ($i1 & $i2) * 10 ^ $i4 & " Ω" & ' (误差:' & $i5 & ')')
EndIf
If GUICtrlRead($Radio50) = $GUI_CHECKED Then
$Var1 = ' ' & $Rdo1_3L[$i1] & ' ' & $Rdo1_3L[$i2] & ' ' & $Rdo1_3L[$i3] & ' ×10^' & $Rdo4L[$i4] & " = "
$Var2 = ($Rdo1_3L[$i1] & $Rdo1_3L[$i2] & $Rdo1_3L[$i3]) * 10 ^ $Rdo4L[$i4]
$Var3 = '(误差:' & $Rdo5L[$i5] & '%)'
;GUICtrlSetData($Label1, ' ' & $i1 & ' ' & $i2 & ' ' & $i3 & ' ×10^' & $i4 & " = " & ($i1 & $i2 & $i3) * 10 ^ $i4 & " Ω" & ' (误差:' & $i5 & ')')
EndIf
If GUICtrlRead($Radio60) = $GUI_CHECKED Then
$Var1 = ' ' & $Rdo1_3L[$i1] & ' ' & $Rdo1_3L[$i2] & ' ' & $Rdo1_3L[$i3] & ' ×10^' & $Rdo4L[$i4] & " = "
$Var2 = ($Rdo1_3L[$i1] & $Rdo1_3L[$i2] & $Rdo1_3L[$i3]) * 10 ^ $Rdo4L[$i4]
$Var3 = '(误差:' & $Rdo5L[$i5] & '% 温度系数:' & $Rdo6L[$i6] & ')'
;GUICtrlSetData($Label1, ' ' & $i1 & ' ' & $i2 & ' ' & $i3 & ' ×10^' & $i4 & " = " & ($i1 & $i2 & $i3) * 10 ^ $i4 & " Ω" & ' (误差:±' & $i5 & ',温度:)' & $i6)
EndIf
Switch $Var2
Case $Var2 < 999
$Var2t = $Var2
Case 1000 To 999999
$Var2t = $Var2 / 1000 & "K"
Case Else
$Var2t = $Var2 / 1000000 & "M"
EndSwitch
GUICtrlSetData($Lab1, $Var1 & $Var2t & 'Ω')
GUICtrlSetData($Lab2, $Var3)
EndFunc ;==>_Calc
|