changing text color in edit box

W

wayne

Dear all,

how can i change the text color in an edit box? apparently, my edit bo
variables are classified as CString so that i m able to output decima
point number.

i knew that SetTextColor is one of the command to do it, but the erro
i got when i compile it is that SetTextColor is not a member o
CString. Hence, i would like to know with CString, wat is the comman
that allows me to change the text color...

thanks alo


-
wayn
 
O

onega

wayne said:
Dear all,

how can i change the text color in an edit box? apparently, my edit box
variables are classified as CString so that i m able to output decimal
point number.

i knew that SetTextColor is one of the command to do it, but the error
i got when i compile it is that SetTextColor is not a member of
CString. Hence, i would like to know with CString, wat is the command
that allows me to change the text color...

thanks alot
Create a font with your wanted color and send WM_SETFONT message to the
edit control.
// Get a handle to a fixed-width font
hObj = GetStockObject(ANSI_FIXED_FONT);
// Set the font for the edit field
SendMessage(editField, WM_SETFONT,(WPARAM)hObj, true);
 
T

thatsalok

wayne said:
*Dear all,

how can i change the text color in an edit box? apparently, my edi
box variables are classified as CString so that i m able to outpu
decimal point number.

i knew that SetTextColor is one of the command to do it, but th
error i got when i compile it is that SetTextColor is not a member o
CString. Hence, i would like to know with CString, wat is the comman
that allows me to change the text color...

thanks alot *

you have to Handle OnCtlColor message for nCtlColor=CTLCOLOR_EDIT an
using pDC->SetColor(...) change the color inside the TextBox i.e. edi
bo


-
thatsalo
 
T

thatsalok

onega said:
Create a font with your wanted color and send WM_SETFONT message to
the
edit control.
// Get a handle to a fixed-width font
hObj = GetStockObject(ANSI_FIXED_FONT);
// Set the font for the edit field
SendMessage(editField, WM_SETFONT,(WPARAM)hObj, true); [/B]

Sorry to point you Mr. Onega! :- there is no color property associated
with Font!

you have to handle OnCtlColor Message or WM_CTLCOLOREDIT in win32 to
Change color in Edit Box
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top