Jump to content

_GUICtrlRichEdit New Line of Text in Different Color


Recommended Posts

Hello.

I am trying to setup an edit control which logs a process's successful steps and its errors. I am trying to do Normal Text (black). Error text (Bold and Red).

I see how to set the character color for a selection of text (_GUICtrlRichEdit_SetCharColor), but this requires character selection and it will be hard to keep track of which characters are in each new line.

Is there an easy way of doing this? I am not seeing a way in the help file.

Local $hGui, $hRichEdit, $iMsg
    $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
            BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    _GUICtrlRichEdit_AppendText($hRichEdit, @CR & "This is more text")

    _GUICtrlRichEdit_SetCharColor($hRichEdit, "304050")

    _GUICtrlRichEdit_AppendText($hRichEdit, @cr & "This is more text")

    GUISetState()

    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                GUIDelete()
                Exit
        EndSelect
    WEnd
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...