回复 12# kxing
请使用“回复”按钮,否则无法及时收到。
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("", 190, 240)
$Edit1 = GUICtrlCreateEdit("", 0, 0, 190, 190, bitor($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL))
$Button1 = GUICtrlCreateButton("显示", 10, 200, 150, 30)
GUISetState(@SW_SHOW)
local $flag = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_SetAutoLine()
EndSwitch
WEnd
Func _SetAutoLine()
Local $text
GUICtrlSetState($Button1, $GUI_DISABLE)
If $flag Then ;不自动换行,有水平滚动条
$text = GUICtrlRead($Edit1)
GUICtrlDelete($Edit1)
$Edit1 = GUICtrlCreateEdit($text, 0, 0, 190, 190, bitor($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL))
$flag = 0
Else ;自动换行,无水平滚动条
$text = GUICtrlRead($Edit1)
$text = StringReplace($text, @CRLF, "")
GUICtrlDelete($Edit1)
$Edit1 = GUICtrlCreateEdit($text, 0, 0, 190, 190, bitor($ES_MULTILINE, $ES_WANTRETURN, $WS_HSCROLL, $ES_AUTOHSCROLL))
$flag = 1
EndIf
GUICtrlSetState($Button1, $GUI_ENABLE)
EndFunc
|