MFC ActiveX控件 怎么才能其能够覆盖其他控件,比如按纽之类的
我做了一个ActiveX控件,在oncreate里面创建了一个CStatic控件:
CRect rectBounds;
this->GetClientRect(rectBounds);
m_pEssImVideoPanel = new CStatic();
m_pEssImVideoPanel->Create(_T(""), WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE, rectBounds, this, IDC_STC_VIDEO);
在OnDraw里处理代码:
CBrush brush(TranslateColor(GetBackColor()));
pdc->FillRect(rcBounds, &brush);
pdc->SetTextColor(TranslateColor(GetForeColor()));
pdc->SetBkMode(OPAQUE);
if (m_pEssImVideoPanel && m_pEssImVideoPanel->m_hWnd)
{
m_pEssImVideoPanel->MoveWindow(rcBounds);
}
在OnCtlColor里处理代码:
HBRUSH hbr = COleControl::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
if(pWnd->GetDlgCtrlID() == IDC_STC_VIDEO)
{
CBrush brush(TranslateColor(GetBackColor()));
CRect rect;
pWnd->GetClientRect(&rect);
pDC->FillRect(rect, &brush);
pDC->SetBkMode(OPAQUE);
hbr = (HBRUSH)::GetStockObject(NULL_BRUSH); // 注意最后这个hbr返回
}
return hbr;
背景颜色是可以设置了,但是在窗体里面插入该控件,怎么使它能够覆盖其他控件,背景怎么看起来是透明的呢
小弟刚接触ActiveX控件,望各位大虾赐教啊