Discussion:
Change color of edit control
(too old to reply)
MFCQuery
2006-06-09 11:21:42 UTC
Permalink
Hi
I create an edit control at run time on a dialog. Now i want to change
background color and text color of this edit control. If someone know please
help.

Thanks
Scott McPhillips [MVP]
2006-06-09 11:59:55 UTC
Permalink
Post by MFCQuery
Hi
I create an edit control at run time on a dialog. Now i want to change
background color and text color of this edit control. If someone know please
help.
Thanks
In MFC: see OnCtlColor

In Win32: see WM_CTLCOLOREDIT
--
Scott McPhillips [VC++ MVP]
MFCQuery
2006-06-09 12:40:05 UTC
Permalink
Hi,

No this doesn't work.
I am creating control at run time.
There is no edit control on dialog box.
I am trying with edit control control and static control.
but it doesn't set the background color.
Post by Scott McPhillips [MVP]
Post by MFCQuery
Hi
I create an edit control at run time on a dialog. Now i want to change
background color and text color of this edit control. If someone know
please help.
Thanks
In MFC: see OnCtlColor
In Win32: see WM_CTLCOLOREDIT
--
Scott McPhillips [VC++ MVP]
Scott McPhillips [MVP]
2006-06-09 16:17:29 UTC
Permalink
Post by MFCQuery
Hi,
No this doesn't work.
I am creating control at run time.
There is no edit control on dialog box.
I am trying with edit control control and static control.
but it doesn't set the background color.
It will work, and it does not matter how you created the control. The
control sends WM_CTLCOLOR/WM_CTLCOLOREDIT to its parent. Make sure you
created the control with the correct parent window. The parent handles
the message in OnCtlColor, like this example:
http://msdn2.microsoft.com/ko-kr/library/0wwk06hc.aspx
--
Scott McPhillips [VC++ MVP]
Jeff Partch [MVP]
2006-06-09 12:02:56 UTC
Permalink
Post by MFCQuery
Hi
I create an edit control at run time on a dialog. Now i want to change
background color and text color of this edit control. If someone know
please help.
Usually by handling WM_CTLCOLOR/CTLCOLOR_EDIT.
--
Jeff Partch [VC++ MVP]
MFCQuery
2006-06-09 12:48:36 UTC
Permalink
Hi,

CtlColor is working CEdit. It's not working for CStatic.
What to do for CStatic?
Post by Jeff Partch [MVP]
Post by MFCQuery
Hi
I create an edit control at run time on a dialog. Now i want to change
background color and text color of this edit control. If someone know
please help.
Usually by handling WM_CTLCOLOR/CTLCOLOR_EDIT.
--
Jeff Partch [VC++ MVP]
Jeff Partch [MVP]
2006-06-09 12:55:16 UTC
Permalink
Post by MFCQuery
Hi,
CtlColor is working CEdit. It's not working for CStatic.
What to do for CStatic?
Maybe WM_CTLCOLOR/CTLCOLOR_STATIC.
--
Jeff Partch [VC++ MVP]
Tom Serface
2006-06-09 16:53:48 UTC
Permalink
http://www.codeguru.com/Cpp/controls/editctrl/backgroundcolor/article.php/c3929/

Even though you're creating it at run time you can still make it a CEdit
version.

Tom
Post by MFCQuery
Hi,
CtlColor is working CEdit. It's not working for CStatic.
What to do for CStatic?
Post by Jeff Partch [MVP]
Post by MFCQuery
Hi
I create an edit control at run time on a dialog. Now i want to change
background color and text color of this edit control. If someone know
please help.
Usually by handling WM_CTLCOLOR/CTLCOLOR_EDIT.
--
Jeff Partch [VC++ MVP]
Continue reading on narkive:
Loading...