void CMFC_ActiveXCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
m_MfcDlg.m_Static.MoveWindow(CRect(rcBounds.left,rcBounds.top,rcBounds.Width()-18,rcBounds.Height()-18),TRUE);
m_MfcDlg.SetWindowPos(NULL,rcBounds.left,rcBounds.top,rcBounds.Width(),rcBounds.Height(),SWP_NOMOVE);
}
void CMFC_Dialog::OnPaint()
{
CPaintDC dc(this);
GetDlgItem(IDC_DISPLAY_IMAGE)->GetClientRect(&m_rectClientRect);
Graphics lGraphics(GetDlgItem(IDC_DISPLAY_IMAGE)->GetDC()->m_hDC);
Pen pen(Color(255,255,0));
lGraphics.DrawRectangle(&pen,Rect(10,10,200,200));
}
When I use this in ActiveX Container,My Application Collapsed.Who can tell me how to use GDI+ in Dialog-Based ActiveX.THANKS!