本帖最后由 即即 于 2009-6-24 15:25 编辑
5# faceyao
首先读取控件内容到变量,然后将需要删除的字符串用StringReplace函数替换为空,再更新控件数据。应该可以达到楼主的意图。#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 348, 298, 189, 121)
$Edit1 = GUICtrlCreateEdit("", 8, 16, 329, 193, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL))
GUICtrlSetData(-1, "这是月季花开实验的文件" & @CRLF & @CRLF & "月季花开")
$Button1 = GUICtrlCreateButton("删除控件部分文本", 208, 240, 123, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_UDF($Edit1, "月季花开")
EndSwitch
WEnd
Func _UDF($control, $delete_string)
;$control=控件ID $delete_string=需要删除的字符串
Local $Read_control = GUICtrlRead($control)
$Read_control = StringReplace($Read_control, $delete_string, "")
GUICtrlSetData($control, "")
GUICtrlSetData($control, $Read_control)
EndFunc ;==>_UDF
|