Text editor

Apr 18, 2013 at 10:41pm
Can anyone give me a hint(or link to tutorial) how to change color of text inside "edit" control? I'm trying to make sth like IDE (where keywords become blue), so how to change color of substring which is in edit control?

I'm talking 'bout win32.
Apr 19, 2013 at 2:17am
You should look into the Scintilla library, it's designed for that.
Apr 19, 2013 at 1:45pm
When I download scintilla, which files do i need and where do i hae to move them?
Apr 19, 2013 at 2:18pm
You could subclass the edit control and colour the text yourself.
Apr 19, 2013 at 6:07pm
1
2
3
4
5
6
7
8
9
10
11
12
(1) Create a new dialog-based (yourself) mfc program
Add an edit control [ID = IDC_EDIT_DEMO], add a button [ID: IDC_BTN_SETCOLOR,]
2. Response IDC_BTN_SETCOLOR button click event handler
 In the previous step before the first in CxxxDlg Add a member variable of type COLORREF [Name: m_clrSel,]
Initialization m_clrSel = RGB (255, 0, 0);
Add the response WM_CTLCOLOR message processing function,
Write the following code
if (IDC_EDIT_DEMO == pWnd-> GetDlgCtrlID ()) / / judgment being drawn is not specified control
{
pDC-> SetTextColor (m_clrSel) ;/ / Set the text color on edit control
return hbr;
}
Topic archived. No new replies allowed.