本帖最后由 happytc 于 2011-10-3 18:41 编辑
如上图,我想把bbbbbbbb那行的字体颜色改成红色,ccccccccc那行改为绿色!
如果这个空间不行,别的控件能达 ...
小凯 发表于 2011-10-3 10:07
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Color.au3>
Main()
Func Main()
Local $hGui, $hRichEdit, $iMsg
$hGui = GUICreate("RichEdit", 320, 250)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW, $hGui)
_GUICtrlRichEdit_SetText($hRichEdit, "aaaaaaaaaa" & @CRLF & "bbbbbbbbbb" & @CRLF & "cccccccccc")
_GUICtrlRichEdit_SetSel($hRichEdit, 0, 10)
_GUICtrlRichEdit_SetCharColor($hRichEdit, "102030")
_GUICtrlRichEdit_SetSel($hRichEdit, 11, 21)
_GUICtrlRichEdit_SetCharColor($hRichEdit, "255")
_GUICtrlRichEdit_SetSel($hRichEdit, 22, 32)
_GUICtrlRichEdit_SetCharColor($hRichEdit, "65280")
While True
$iMsg = GUIGetMsg()
Switch $iMsg
Case $GUI_EVENT_CLOSE
_GUICtrlRichEdit_Destroy($hRichEdit)
Exit
EndSwitch
WEnd
EndFunc
|