找回密码
 加入
搜索
查看: 2239|回复: 8

[AU3基础] [已解决] ]如何设置 GUICtrlCreateUpdown 增减大小为 0.1 或100

  [复制链接]
发表于 2016-11-25 22:23:36 | 显示全部楼层 |阅读模式
本帖最后由 chishingchan 于 2016-11-28 17:18 编辑

GUICtrlCreateUpdown 控件按上下箭头默认是 1,可不可以设置为 0.1 ?或者以 100 增减?谢谢!

答案在 5 楼。
发表于 2016-11-26 01:51:53 | 显示全部楼层
还有这个函数,看了帮助没有什么参数设置,顶一下。
 楼主| 发表于 2016-11-26 14:36:09 | 显示全部楼层
  暂时使用输入控件合并。

本帖子中包含更多资源

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

×
发表于 2016-11-26 15:35:25 | 显示全部楼层
回复 3# chishingchan


    能不能添加事件,加了时候 从新设置控件的值
发表于 2016-11-28 16:49:38 | 显示全部楼层
回复 1# chishingchan
#include <GuiConstantsEx.au3> 
#include <EditConstants.au3> 

Global $Last_Set_Value = 0 

$GUI = GUICreate("Test Script", 300, 200) 

$Input = GUICtrlCreateInput(0, 20, 40, 80, 20, BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_READONLY)) 
$UpDown = GUICtrlCreateUpdown($Input) 
GUICtrlSetBkColor($Input, 0xFFFFFF) 

GUISetState(@SW_SHOW, $GUI) 

While 1 
    $nMsg = GUIGetMsg() 
    Switch $nMsg 
        Case $GUI_EVENT_CLOSE 
            Exit 
        Case $UpDown 
            If Mod(GUICtrlRead($Input), 10) = 0 Then
                GUICtrlSetData($Input, GUICtrlRead($Input)/10&".0")
            Else
                GUICtrlSetData($Input, GUICtrlRead($Input)/10)
            EndIf
    EndSwitch 
WEnd

评分

参与人数 1金钱 +10 收起 理由
chishingchan + 10 谢谢!

查看全部评分

 楼主| 发表于 2016-12-3 21:18:14 | 显示全部楼层
本帖最后由 chishingchan 于 2016-12-3 21:19 编辑

回复 5# kk_lee69


    这个帖子总结早了!请给个上下箭头在 400 至 -800 之间,每按一次下下箭头加减100的例子,默认值-400,谢谢!
发表于 2016-12-3 22:20:16 | 显示全部楼层
回复 6# chishingchan

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $title, $input1, $input2, $updown, $iUpDown = 0, $iCurrent = -400

$title = "My GUI UpDown"
GUICreate($title, -1, -1, -1, -1, $WS_SIZEBOX)

$input1 = GUICtrlCreateInput(StringFormat("%#.1f", $iCurrent), 10, 10, 100, 20); Current value

$input2 = GUICtrlCreateInput(0, 110, 10, 20, 20); UpDown offset value
$updown = GUICtrlCreateUpdown($input2)

GUISetState()

; Update the current value until the dialog is closed
Do
    $iUpDown = Number(GUICtrlRead($input2))
    If $iUpDown <> 0 Then
        $iCurrent += ($iUpDown * 100)
                IF $iCurrent >= 400 Then
                        $iCurrent=400
                ElseIf $iCurrent <= -800 Then
                        $iCurrent=-800
                EndIf
        GUICtrlSetData($input1, StringFormat("%#.1f", $iCurrent))
        GUICtrlSetData($input2, 0)
    EndIf
Until GUIGetMsg() = $GUI_EVENT_CLOSE

评分

参与人数 1金钱 +10 收起 理由
chishingchan + 10

查看全部评分

 楼主| 发表于 2016-12-4 13:45:15 | 显示全部楼层
回复 7# kk_lee69


    谢谢!昨天晚上我想了很久也想到处理方法,请点评,谢谢!
#include <GuiConstantsEx.au3> 
#include <EditConstants.au3> 
 
Global $Last_Set_Value = 0 ,$L=-400
 
$GUI = GUICreate("Test Script", 300, 200) 
 
$Input = GUICtrlCreateInput(-400, 20, 40, 80, 20, BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_READONLY)) 
$UpDown = GUICtrlCreateUpdown($Input) 
GUICtrlSetLimit($UpDown, 400, -800)
GUICtrlSetBkColor($Input, 0xFFFFFF) 
 
GUISetState(@SW_SHOW, $GUI) 
 
While 1 
    $nMsg = GUIGetMsg() 
    Switch $nMsg 
        Case $GUI_EVENT_CLOSE 
            Exit 
        Case $UpDown 
                If GUICtrlRead($Input) > $L Then
                        $L = GUICtrlRead($Input) + 99
                        GUICtrlSetData($Input, $L)
                ElseIf GUICtrlRead($Input) < $L Then
                        $L = GUICtrlRead($Input) - 99
                        GUICtrlSetData($Input, $L)
                EndIf
    EndSwitch 
WEnd
发表于 2017-4-26 10:19:43 | 显示全部楼层
十分感谢!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-25 18:36 , Processed in 0.083395 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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