#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 332, 188, 192, 124)
$Group1 = GUICtrlCreateGroup("原始数据", 16, 8, 297, 81)
$Label1 = GUICtrlCreateLabel("单价(元/升):", 32, 24, 80, 17)
$Label2 = GUICtrlCreateLabel("总价(元):", 176, 24, 80, 17)
$Label3 = GUICtrlCreateLabel("行驶距离(公里):", 32, 56, 100, 17)
$Input1 = GUICtrlCreateInput("0", 110, 24, 60, 21)
$Input2 = GUICtrlCreateInput("0", 240, 24, 60, 21)
$Input3 = GUICtrlCreateInput("0", 135, 56, 60, 21)
$JS=GUICtrlCreateButton("计算",210,56,90,25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("计算结果", 16, 96, 297, 81)
$Label4 = GUICtrlCreateLabel("每公里耗油:", 32, 120, 140, 17)
$Label5 = GUICtrlCreateLabel("每百公里耗油:", 176, 120, 140, 17)
$Label6 = GUICtrlCreateLabel("每公里费用:", 32, 144, 140, 17)
$Label7 = GUICtrlCreateLabel("每百公里费用:", 176, 144,140, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $JS
$a=Number(GUICtrlRead($Input1))
$b=Number(GUICtrlRead($Input2))
$c=Number(GUICtrlRead($Input3))
If $a=0 Or $b=0 Or $c=0 Then ContinueCase
$Km1Y=Round($b/$a/$c,2)
$Km100Y=Round($b/$a/$c*100,2)
$Km1F=Round($b/$c,2)
$Km100F=Round($b/$c*100,2)
GUICtrlSetData($Label4,"每公里耗油:"&$Km1Y)
GUICtrlSetData($Label5,"每百公里耗油:"&$Km100Y)
GUICtrlSetData($Label6,"每公里费用:"&$Km1F)
GUICtrlSetData($Label7,"每百公里费用:"&$Km100F)
EndSwitch
WEnd