#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Global $lnzong,$Inzong,$nzong
Global $lgmao,$Igmao,$gmao
Global $lgche,$Igche,$gche
Global $lnkuang,$Inkuang,$nkuang
Global $lgkuang,$Igkuang
Global $lgshui,$Igshui,$gshui
Global $lnfei,$Infei,$nfei
Global $lgfei,$Igfei,$gfei
Global $lgshi,$Igshi,$gshi
Global $lG,$IG,$G2,$G3
Example1()
; example 1
Func Example1()
Local $msg
GUICreate("计算",1000,500,0,0) ; will create a dialog box that when displayed is centered
GUISetState(@SW_SHOW) ; will display an empty dialog box
$lnzong=GUICtrlCreateLabel("总只数",40,100,50,15)
$Inzong=GUICtrlCreateInput("",20,120,70,15)
$lgmao=GUICtrlCreateLabel("毛重",120,100,50,15)
$Igmao=GUICtrlCreateInput("",100,120,70,15)
$lgkuang=GUICtrlCreateLabel("筐重",200,100,50,15)
$Igkuang=GUICtrlCreateInput("",180,120,50,15)
$lnkuang=GUICtrlCreateLabel("筐的数量",260,100,70,15)
$Inkuang=GUICtrlCreateInput("",260,120,50,15)
$lgche=GUICtrlCreateLabel("车重",340,100,70,15)
$Igche=GUICtrlCreateInput("",320,120,70,15)
$lgshui=GUICtrlCreateLabel("水杂扣重",420,100,70,15)
$Igshui=GUICtrlCreateInput("",400,120,70,15)
$lnfei=GUICtrlCreateLabel("废弃只数",500,100,70,15)
$Infei=GUICtrlCreateInput("",490,120,70,15)
$lgfei=GUICtrlCreateLabel("废弃重量",580,100,70,15)
$Igfei=GUICtrlCreateInput("",570,120,70,15)
$lgshi=GUICtrlCreateLabel("食污扣重",660,100,70,15)
$Igshi=GUICtrlCreateInput("",650,120,70,15)
$lG=GUICtrlCreateLabel("净重",730,100,70,15)
$IG=GUICtrlCreateInput("",730,120,70,15)
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
do
$lnzong=GUICtrlRead($Inzong)
$lgmao=GUICtrlRead($Igmao)
$lnkuang=GUICtrlRead($Inkuang)
$lgkuang=GUICtrlRead($Igkuang)
$lgshui=GUICtrlRead($Igshui)
$lnfei=GUICtrlRead($Infei)
$lgche=GUICtrlRead($Igche)
$lgfei=$lgmao/$lnzong+$lgkuang; 此步混合运算出错
GUICtrlSetData($Igfei,$lgfei)
Until $lnzong<0&$lnkuang<0&$lgmao<0
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
EndFunc ;==>Example1 |