找回密码
 加入
搜索
查看: 1886|回复: 4

[AU3基础] [已解决]求教怎么定义一个让用户输入的数组长度

[复制链接]
发表于 2017-4-23 10:08:02 | 显示全部楼层 |阅读模式
本帖最后由 没有知道 于 2017-4-24 21:19 编辑

怎么可以让$d的数组长度是同过$Input2和$Input3控件输入的来控制
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <array.au3>





#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 680, 353)
$Label1 = GUICtrlCreateLabel("单元", 8, 16, 40, 17)
$Input1 = GUICtrlCreateInput("", 48, 16, 57, 21)
$Label2 = GUICtrlCreateLabel("有楼层", 136, 16, 52, 17)
$Input2 = GUICtrlCreateInput("", 192, 16, 121, 21)
$Label3 = GUICtrlCreateLabel("房号", 336, 16, 28, 17)
$Input3 = GUICtrlCreateInput("", 376, 16, 121, 21)
$Button1 = GUICtrlCreateButton("生成", 520, 16, 75, 25)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

Dim $fenxianxiang, $louceng ,$hushu
Local $d[50][11]

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $danyuan=GUICtrlRead($Input1)
                        $louceng = GUICtrlRead($Input2)
                        $hushu = GUICtrlRead($Input3)

                        For $x = 0 To $louceng

                                $d[$x][0] = $danyuan & "单元"

                                For $y = 1 To $hushu 
                                        
                                        $d[$x][1] = $x & "楼" 

                                        $d[$x][$y+1] = $x & "0" & $y
                                                                                
                                Next
                                
                        Next


                                _ArrayDisplay($d)

        EndSwitch
WEnd
发表于 2017-4-23 11:13:30 | 显示全部楼层
GUICtrlSetLimit($input1, 10)
帮助文件告诉我的。$input1限制输入10个字符
发表于 2017-4-23 11:38:21 | 显示全部楼层
数组建立后,可以按需要 ReDim
发表于 2017-4-24 17:10:34 | 显示全部楼层
ReDim   $b[你要重新定义的长度][你要重新定义的长度]
 楼主| 发表于 2017-4-24 21:17:38 | 显示全部楼层
谢谢,问题解决了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-24 19:35 , Processed in 0.075474 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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