3 Replies - 498 Views - Last Post: 08 September 2011 - 07:53 AM Rate Topic: -----

#1 James_Alex  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 7
  • View blog
  • Posts: 156
  • Joined: 21-August 09

Coloring a word of editbox text

Posted 07 September 2011 - 02:27 PM

hey, as the title descripes, i wanna color only a few words on an editbox text
example
int mayVar;

i already have everything set up
	m_hScriptEdit = CreateWindow("edit", "", WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_BORDER | ES_MULTILINE | ES_AUTOVSCROLL, 0, 0, rwindow.right-(rwindow.right/6), 
		rwindow.bottom-(rwindow.bottom/6), hWnd, (HMENU)ID_SCRIPT_EDIT, GetModuleHandle(NULL), 0);
	m_hFuncEdit = CreateWindow("edit", "", WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_BORDER | ES_MULTILINE | ES_AUTOVSCROLL, rwindow.right-(rwindow.right/6), 0, rwindow.right/6, 
		rwindow.bottom-(rwindow.bottom/6), hWnd, (HMENU)ID_FUNC_EDIT, GetModuleHandle(NULL), 0);
	m_hErrorEdit = CreateWindow("edit", "", WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_BORDER | ES_MULTILINE | ES_AUTOVSCROLL, 0, rwindow.bottom-(rwindow.bottom/6), rwindow.right, 
		rwindow.bottom/6, hWnd, (HMENU)ID_ERROR_EDIT, GetModuleHandle(NULL), 0);



i know how to color only all the text (using SetTextColor), but no just few words
by the way, i know how to check for keywords and separate them from the rest of the text
i just need to draw them in blue then the rest in black ...
any help will be appreciated

Is This A Good Question/Topic? 0
  • +

Replies To: Coloring a word of editbox text

#2 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1371
  • View blog
  • Posts: 4,750
  • Joined: 19-February 09

Re: Coloring a word of editbox text

Posted 07 September 2011 - 05:31 PM

Hi, with the Edit control the only way I can think of, is to do the window painting yourself.

You could try looking at the Rich Edit Control.

Nice example using color - Richedit control

MSDN Using Rich Edit Controls
Was This Post Helpful? 1
  • +
  • -

#3 James_Alex  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 7
  • View blog
  • Posts: 156
  • Joined: 21-August 09

Re: Coloring a word of editbox text

Posted 07 September 2011 - 05:42 PM

View Post#define, on 07 September 2011 - 05:31 PM, said:

Hi, with the Edit control the only way I can think of, is to do the window painting yourself.

You could try looking at the Rich Edit Control.

Nice example using color - Richedit control

MSDN Using Rich Edit Controls


awesome example
thanks very much
ill try on myself
Was This Post Helpful? 0
  • +
  • -

#4 James_Alex  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 7
  • View blog
  • Posts: 156
  • Joined: 21-August 09

Re: Coloring a word of editbox text

Posted 08 September 2011 - 07:53 AM

hey, i succeeded to get my keywords to be rendered in blue
but the probleme with that is that it selects then deselects the keyword on every frame, so im not free to where ill write my next text
so whats the painting myself method, i mean can i write every single word of an editbox with differente colors when painting ?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1