找回密码
 加入
搜索
查看: 2460|回复: 5

[AU3基础] 如何获得EDIT文本框行数

  [复制链接]
发表于 2010-5-4 13:53:18 | 显示全部楼层 |阅读模式
如何获得EDIT文本框行数,  还有edit指定行数数据。
发表于 2010-5-4 15:05:36 | 显示全部楼层
本帖最后由 水木子 于 2010-5-4 15:09 编辑

嘿嘿!笨办法,不知道有没有直接函数。
#include <WindowsConstants.au3>

GUICreate("Form1", 300, 280)
$Edit1 = GUICtrlCreateEdit("", 5, 5, 290, 200)
$But1 = GUICtrlCreateButton("获取行数", 100, 230, 80, 30, $WS_GROUP)
GUISetState()

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case - 3
                        Exit
                Case $But1
                        MsgBox(0, '提示!', 'Edit控件内有 ' & Lines(GUICtrlRead($Edit1)) & ' 行文本')
        EndSwitch
WEnd

Func Lines($Text)
        $aReg = StringRegExp($Text, '.+', 3)
        $Line = UBound($aReg)
        Return $Line
EndFunc   ;==>Lines
发表于 2010-5-4 15:37:46 | 显示全部楼层
统计回车的数量或者用
_GUICtrlEdit_GetLineCount($hWnd)
发表于 2010-5-4 15:55:43 | 显示全部楼层
统计回车的数量或者用
_GUICtrlEdit_GetLineCount($hWnd)
大绯狼 发表于 2010-5-4 15:37


学习了,看来还是有现成函数的。
 楼主| 发表于 2010-5-4 19:37:44 | 显示全部楼层
$1 = ControlCommand("","",$Edit1,"GetLineCount","")
                        MsgBox(0,"",$1)
这样也可以   还有如何读取指定行数数据
发表于 2010-5-7 06:56:47 | 显示全部楼层
_GUICtrlEdit_GetLine($hWnd, $iLine)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-14 03:12 , Processed in 0.077466 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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