how to create a transparent Edit control on a CWnd object, while not a CDialog object?
-
I want to create a transparent RichEdit control, and find many example use follow code in parent dialog class: HBRUSH CParentDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if((nCtlColor == CTLCOLOR_EDIT) && (pWnd->GetDlgCtrlID()==IDC_MYRICHEDIT)) { pDC->SetBkMode(TRANSPARENT); pDC->SetTextColor(RGB(255,0,0)); return HBRUSH(GetStockObject(HOLLOW_BRUSH)); } } It does not work in my application. I think maybe because which I create is CRichEditCtrl while those example create CEdit, or maybe because my parent window is CWnd class while those example use CDialog class. Anyone can tell me what the problem is, and how to fix it? help me create a transparent RichEdit control successfully, thanks a lot.:confused:
-
I want to create a transparent RichEdit control, and find many example use follow code in parent dialog class: HBRUSH CParentDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if((nCtlColor == CTLCOLOR_EDIT) && (pWnd->GetDlgCtrlID()==IDC_MYRICHEDIT)) { pDC->SetBkMode(TRANSPARENT); pDC->SetTextColor(RGB(255,0,0)); return HBRUSH(GetStockObject(HOLLOW_BRUSH)); } } It does not work in my application. I think maybe because which I create is CRichEditCtrl while those example create CEdit, or maybe because my parent window is CWnd class while those example use CDialog class. Anyone can tell me what the problem is, and how to fix it? help me create a transparent RichEdit control successfully, thanks a lot.:confused:
Hi, Have u called
AfxInitRichEdit
inInitInstance
of your application ?? Appu.. "If you judge people, you have no time to love them." -
Hi, Have u called
AfxInitRichEdit
inInitInstance
of your application ?? Appu.. "If you judge people, you have no time to love them."