Colored background and text in a CEdit control 
Author Message
 Colored background and text in a CEdit control

I am trying to use MFC's message reflection to handle control coloring
in my CEdit-derived class.  However, my CtlColor member function is
never called.  There are two catches to the way I'm doing this that
might be responsible.  First, the parent window is derived from
CScrollView, not CDialog, though the documentation states that any
window derived from CWnd is fine.  Second, the CEdit-derived object is
implemented and created within a User DLL (the view window lives
within the application itself).  That means it has it's own window
mapping pool, which is probably the problem.

This is just ridiculous.  I want my control to be able to control, no
pun intended, it's own coloring.  I do not want the view window to
even know this window exists!  Apparently there is no way to do this
with the CEdit class.  Microsoft really screwed up with both the whole
WM_CTLCOLOR implementation and with MFC's CEdit implementation.  There
should be a simple way to tell the control to set the text and
background colors.

I guess I'll be rolling my own edit control unless someone here has
some arcane knowledge for me.

Brent



Tue, 12 Nov 2002 03:00:00 GMT  
 Colored background and text in a CEdit control
Brent:

Before badmouthing the Microsoft implementation of message reflection,
why don't you just set up a simple dialog application with a derived
edit control? There is a sample called CYellowEdit (I think) which shows
you how to do this. It's very easy to do, and it works.

I'm not sure about the DLL issue.

David Wilkinson

===================

Quote:

> I am trying to use MFC's message reflection to handle control coloring
> in my CEdit-derived class.  However, my CtlColor member function is
> never called.  There are two catches to the way I'm doing this that
> might be responsible.  First, the parent window is derived from
> CScrollView, not CDialog, though the documentation states that any
> window derived from CWnd is fine.  Second, the CEdit-derived object is
> implemented and created within a User DLL (the view window lives
> within the application itself).  That means it has it's own window
> mapping pool, which is probably the problem.

> This is just ridiculous.  I want my control to be able to control, no
> pun intended, it's own coloring.  I do not want the view window to
> even know this window exists!  Apparently there is no way to do this
> with the CEdit class.  Microsoft really screwed up with both the whole
> WM_CTLCOLOR implementation and with MFC's CEdit implementation.  There
> should be a simple way to tell the control to set the text and
> background colors.

> I guess I'll be rolling my own edit control unless someone here has
> some arcane knowledge for me.

> Brent



Tue, 12 Nov 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. set the text color and the background color of a Control Cbutton

2. Background & Text color CEdit

3. Changing Background Color of CEdit - Problem With Double Clicking On Texts

4. Setting text and background color in CEdit

5. background color of CEdit control

6. Changing the default background color of disabled control (CEdit)

7. Background color in CEdit Control ?

8. How to change background color of a dynamically created CEdit control

9. Change background color of disabled CEdit controls

10. Changing the Background Color of Individual CEdit controls in a CDialogBar

11. Changing color of background of a CEdit control

12. How do you set the background color of a CEdit control

 

 
Powered by phpBB® Forum Software