CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2007
    Posts
    52

    Arrow Subclassed Dynamical control won't show

    Here we are again with my stupid questions.. but I searched google, I searched this forum and could not find a solution.

    I usually am able to use controls subclassing, but this time I can't get it working.



    3 codes:

    1)

    void CProvaDialogDlg::OnBnClickedButton1()
    {
    CUnknownCtrl* pUnknown;
    pUnknown = new CUnknownCtrl;
    pUnknown->Create("LOL", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, CRect(11,35,360,526), this, 0x31);
    }

    2) UnknownCtrl.h
    public:
    afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
    CBrush* m_brush;

    3)UnknownCtrl.cpp
    CUnknownCtrl::CUnknownCtrl()
    {
    m_brush = (CBrush*)CreateSolidBrush(RGB(255,0,0));
    }
    HBRUSH CUnknownCtrl::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    HBRUSH hbr = CStatic::OnCtlColor(pDC, pWnd, nCtlColor);

    //Change background colour
    pDC->SetBkMode(OPAQUE); //No background action
    pDC->SetBkColor(RGB(255,0,0)); // change the text color
    return (HBRUSH)(m_brush->GetSafeHandle());

    //return hbr;
    }




    Why my control can be displayed but cannot be backgrounded?
    Where is my error?
    Thanks for any help

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Subclassed Dynamical control won't show

    Backgrounded? What would that mean?
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured