void CInfusionHistory::OnPaint()
{
CPaintDC dc(this); // 用于绘制的设备上下文
m_nPosDataDisplay = 0;
m_nFlagRun = 2;
this->GetClientRect(&rect);
pDC =  new CClientDC(this);
MemDC.CreateCompatibleDC(NULL);
MemBitmap.CreateCompatibleBitmap(pDC,rect.right,rect.bottom); 
CBitmap *pOldBit=MemDC.SelectObject(&MemBitmap);
//*填充整个区域*
MemDC.FillSolidRect(CRect(0,0,rect.right, rect.bottom),RGB(12, 108,89));
//*画坐标*
DrawCoordinate();
if(m_nPictureFlag==0)
{
DealInfusionInfo();
}
else if(m_nPictureFlag==1)
{
ReadInfoFromDB();
}
else if(m_nPictureFlag==2)
{
ReadInfoFromDB();
} //-----标题-----
if(font2.GetSafeHandle())
{
font2.DeleteObject();
}
::ZeroMemory(&lf,sizeof(lf));
lf.lfHeight = 30;
lf.lfWeight = 800;
lf.lfItalic = false;
wcscpy(lf.lfFaceName,_T("Arial"));
font2.CreateFontIndirect(&lf); m_Static_Caption.SetFont(&font2); m_Static_Caption.SetWindowTextW(strCaption); m_Static_Caption.Invalidate();
//-----标题-----
switch(GetApp()->m_CurLanguage)
{
case LANGUAGE_CHS:
m_BN_Back.SetWindowTextW(L"返回");
m_BN_Print.SetWindowTextW(L"打印");
break;
case LANGUAGE_ENG:
m_BN_Back.SetWindowTextW(L"BACK");
m_BN_Print.SetWindowTextW(L"PRINT");
break;
default:
;
}
if(m_nPictureFlag==0)
{
m_BN_Back.ShowWindow(FALSE);
m_BN_Back.Invalidate();
}
else
{
m_BN_Back.ShowWindow(TRUE);
m_BN_Back.Invalidate();
}
m_BN_Print.Invalidate(); pDC->BitBlt(0,0,rect.right,rect.bottom,&MemDC,0,0,SRCCOPY); 
MemDC.SelectObject(pOldBit);
MemBitmap.DeleteObject(); 
MemDC.DeleteDC(); 
delete pDC;//---------------------------------------------------程序停在这里,触发断点
m_nFlagRun = 0;
}

解决方案 »

  1.   

    BOOL CGdiObject::Attach(HGDIOBJ hObject)
    {
    ASSERT(m_hObject == NULL);      // only attach once, detach on destroy
    if (hObject == NULL)
    {
    return FALSE;
    }
    // remember early to avoid leak
    m_hObject = hObject;
    CHandleMap* pMap = afxMapHGDIOBJ(TRUE); // create map if not exist
    ASSERT(pMap != NULL);
    pMap->SetPermanent(m_hObject, this);
    return TRUE;
    }现在在这附近断了。
      

  2.   

    ATLCOMTIME_INLINE COleDateTime::operator DATE() const throw()
    {
    ATLASSERT(GetStatus() == valid);
    return( m_dt );
    }现在又在这了