CEdit text color 
Author Message
 CEdit text color

Hello,

I have a CEdit-derived control where I post messages from the server I am
monitoring. I can change the color of the messages but it is for all
messages.

What I would like to do is set the color of warning messages to yellow,
standard responses to green, and error messages to red. As I mentioned I can
change the text color for all messages, but what i would like to do is per
maessage.

Does anyone know how to do this?

Thanks,
Greg



Tue, 02 Nov 2004 07:41:03 GMT  
 CEdit text color
        Use CRichEditCtrl instead of CEdit.

--
Cheers
Check Abdoul
----------------


Quote:
> Hello,

> I have a CEdit-derived control where I post messages from the server I am
> monitoring. I can change the color of the messages but it is for all
> messages.

> What I would like to do is set the color of warning messages to yellow,
> standard responses to green, and error messages to red. As I mentioned I
can
> change the text color for all messages, but what i would like to do is per
> maessage.

> Does anyone know how to do this?

> Thanks,
> Greg



Tue, 02 Nov 2004 08:53:19 GMT  
 CEdit text color

Quote:
> I have a CEdit-derived control where I post messages from the server I am
> monitoring. I can change the color of the messages but it is for all
> messages

U should use ON_WM_CTLCOLOR

HBRUSH CNameView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
    HBRUSH hbr;
    CBrush m_brush;
    m_brush.CreateSolidBrush(RGB(0,0,0));
    switch (nCtlColor)
    {
        case CTLCOLOR_EDIT:
        case CTLCOLOR_MSGBOX:

        switch (pWnd->GetDlgCtrlID())
        {
            case IDC_EDIT1:
                pDC->SetBkColor(RGB(192,192,192));
                pDC->SetTextColor(RGB(255,0,0));
                hbr = (HBRUSH) m_brush;
            break;
            default:
                hbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
            break;
        }
        break;
        default:hbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
    }
    return hbr;

Quote:
}



Tue, 02 Nov 2004 14:54:10 GMT  
 CEdit text color


Quote:
> Hello,

> I have a CEdit-derived control where I post messages from the server I am
> monitoring. I can change the color of the messages but it is for all
> messages.

> What I would like to do is set the color of warning messages to yellow,
> standard responses to green, and error messages to red. As I mentioned I
can
> change the text color for all messages, but what i would like to do is per
> maessage.

> Does anyone know how to do this?

> Thanks,
> Greg

Better still would be to use a listbox for logging.  See Dr Newcomers
article on a logging list box in the MVP tips at this site:
http://www.pgh.net/~newcomer

Best Regards
Julian N.



Tue, 02 Nov 2004 17:12:54 GMT  
 CEdit text color
Hello,

Thanks for all the help! Every suggestion was very good!

Cheers,
Greg



Quote:



> > Hello,

> > I have a CEdit-derived control where I post messages from the server I
am
> > monitoring. I can change the color of the messages but it is for all
> > messages.

> > What I would like to do is set the color of warning messages to yellow,
> > standard responses to green, and error messages to red. As I mentioned I
> can
> > change the text color for all messages, but what i would like to do is
per
> > maessage.

> > Does anyone know how to do this?

> > Thanks,
> > Greg

> Better still would be to use a listbox for logging.  See Dr Newcomers
> article on a logging list box in the MVP tips at this site:
> http://www.pgh.net/~newcomer

> Best Regards
> Julian N.



Tue, 02 Nov 2004 23:02:20 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. CEdit text color

2. CEdit text color

3. Disabled CEdit Text Color

4. CEdit Text Color

5. CEdit Text Color

6. Background & Text color CEdit

7. Changing text color in a CEdit box

8. coloring text in CEdit or....?

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

10. Question on changing text color in CEdit Control

11. CEdit and text color

12. CEdit Disabled Text Color

 

 
Powered by phpBB® Forum Software