Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

changing a text box's background color

taansaritaansari Posts: 8Member
could some1 plz elaborately tell me how to change the background color of a text-box? like, step by step process? any help would be greatly appretiated!

i have tried searching for similar keywords but the replys were unclear to me...

Comments

  • TheViceTheVice Posts: 8Member
    You should subclass the CEdit control and override the WM_CTLCOLOR_REFLECT message. The write the code similar to this :

    HBRUSH CSubEdit::CtlColor(CDC* pDC, UINT nCtlColor)
    {
    pDC->SetTextColor(m_ForeColor);
    pDC->SetBkColor(m_BackColor);
    return (HBRUSH)m_Brush; // member CBrush created with m_BackCOlor
    }




Sign In or Register to comment.