找回密码
 加入
搜索
查看: 1258|回复: 2

如何填回值至GUI Input裡面

[复制链接]
发表于 2009-2-25 15:21:15 | 显示全部楼层 |阅读模式
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <string.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("電阻分壓計算", 482, 313, 307, 168)
$Input1= GUICtrlCreateInput("", 184, 104, 65, 21)
$Input2 = GUICtrlCreateInput("", 184, 144, 65, 21)
$Input3 = GUICtrlCreateInput("", 184, 184, 65, 21)
$Input4 = GUICtrlCreateInput("", 184, 224, 65, 21)
$Button1 = GUICtrlCreateButton("Cal", 320, 152, 89, 57, 0)
$Button2 = GUICtrlCreateButton("Exit", 320, 220, 89, 57, 0)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xC0DCC0)
GUICtrlSetCursor (-1, 0)

$Label1 = GUICtrlCreateLabel("Vin:", 136, 104, 35, 24) ;Vin
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Vout:", 128, 144, 47, 24) ;vout
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("R1", 136, 184, 25, 24)  ;R1
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("R2", 136, 224, 25, 24) ;R2
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("電阻分壓計算", 168, 56, 88, 17)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Dim $Vin=1,$Vout=1,$R1=1,$R2=1,$val=0
        
        
        
While 1
$nMsg = GUIGetMsg()

Switch $nMsg
        Case $GUI_EVENT_CLOSE
                MsgBox(0, "", "Dialog was closed")
                Exit

        Case $Button1
                ;Hex = _StringToHex($Input1)
                
             $Vin=GUICtrlRead($Input1)
                 $R1=GUICtrlRead($Input3)
                 $R2=GUICtrlRead($Input4)
                 $Vout=($vin*$R2)/($R1+$R2)
                 ;=$Vout
                MsgBox(0, "Default button clicked","Vout=" & $Vout)
                
                ;MsgBox(0, "Default button clicked","Hex=" & $Hex)
        Case $Button2
                Exit
EndSwitch
WEnd
請問各位大大:
  如何填回值至GUI Input裡面呢?
感謝。

[ 本帖最后由 stanley1974 于 2009-2-25 16:56 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-2-25 15:26:06 | 显示全部楼层
GUICtrlSetData($Input2,$Vout)
 楼主| 发表于 2009-2-25 16:55:37 | 显示全部楼层
感謝cnsnc 大大的幫忙。已經可以了。謝謝。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-18 21:35 , Processed in 0.082577 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表