|
-
April 3rd, 2008, 02:26 PM
#1
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
-
April 3rd, 2008, 04:14 PM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|