这些代码什么作用吖?MFC高手来答
voidCMyDIPView::OnDraw(CDC*pDC){CMyDIPDoc*pDoc=GetDocument();ASSERT_VALID(pDoc);if(pD...
void CMyDIPView::OnDraw(CDC* pDC)
{
CMyDIPDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if(pDoc->m_hDIB == NULL)
return ;
int i,j;
unsigned char *lpSrc;
LPSTR lpDIB = (LPSTR) ::GlobalLock((HGLOBAL) pDoc->m_hDIB);
int cxDIB = (int) ::DIBWidth(lpDIB);
int cyDIB = (int) ::DIBHeight(lpDIB);
LPSTR lpDIBBits=::FindDIBBits (lpDIB);
long lLineBytes = WIDTHBYTES(cxDIB * 8);
for(i = 0; i < cyDIB; i++)
{
for(j = 0; j < cxDIB; j++)
{
lpSrc = (unsigned char*)lpDIBBits + lLineBytes * (cyDIB - 1 - i) + j;
}
}
::GlobalUnlock((HGLOBAL) pDoc->m_hDIB);
CRect rect(0,0,cxDIB,cyDIB), rcDIB(0,0,cxDIB,cyDIB);
::PaintDIB(pDC->m_hDC, &rect, pDoc->m_hDIB, &rcDIB, pDoc->m_palDIB);
} 展开
{
CMyDIPDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if(pDoc->m_hDIB == NULL)
return ;
int i,j;
unsigned char *lpSrc;
LPSTR lpDIB = (LPSTR) ::GlobalLock((HGLOBAL) pDoc->m_hDIB);
int cxDIB = (int) ::DIBWidth(lpDIB);
int cyDIB = (int) ::DIBHeight(lpDIB);
LPSTR lpDIBBits=::FindDIBBits (lpDIB);
long lLineBytes = WIDTHBYTES(cxDIB * 8);
for(i = 0; i < cyDIB; i++)
{
for(j = 0; j < cxDIB; j++)
{
lpSrc = (unsigned char*)lpDIBBits + lLineBytes * (cyDIB - 1 - i) + j;
}
}
::GlobalUnlock((HGLOBAL) pDoc->m_hDIB);
CRect rect(0,0,cxDIB,cyDIB), rcDIB(0,0,cxDIB,cyDIB);
::PaintDIB(pDC->m_hDC, &rect, pDoc->m_hDIB, &rcDIB, pDoc->m_palDIB);
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询