大哥,你帮我看看这一段函数代码:
void CImageProcessView::DrawAll(CDC *pDC)
{
CImageProcessDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
CFont NewFont;
CFont *pOldFont;
CPen NewPen(PS_SOLID,CPublic::m_LineWidth,CPublic::m_DrawColor);
CPen *pOldPen;
NewFont.CreateFontIndirect(&m_LogFont);
pOldFont = pDC->SelectObject(&NewFont);
pDC->SetTextColor(CPublic::m_DrawColor);
pOldPen=pDC->SelectObject(&NewPen);
if (this->m_IsStatis)
{
if (!m_ImageStatis.IsNull())
{
SetStretchBltMode(pDC->m_hDC, STRETCH_HALFTONE);
m_ImageStatis.StretchBlt(pDC->m_hDC,0,0,m_ImageStatis.GetWidth()*CPublic::m_ZoomValue,m_ImageStatis.GetHeight()*CPublic::m_ZoomValue,SRCCOPY);
}
return;
}
if (!this->m_IsPrinting)
{
if (!m_ImagetoCompare.IsNull())
{
if (!m_Image.IsNull())
{
SetStretchBltMode(pDC->m_hDC, STRETCH_HALFTONE);
m_Image.StretchBlt(pDC->m_hDC,0,0,m_Image.GetWidth()/CPublic::zip,m_Image.GetHeight()/CPublic::zip,SRCCOPY);
}
double width = m_ImagetoCompare.GetWidth()*
pImageCmparedlg->m_ImageToCompateScale
/CPublic::m_CurScaleValue/CPublic::zip;
double height = m_ImagetoCompare.GetHeight()*
pImageCmparedlg->m_ImageToCompateScale
/CPublic::m_CurScaleValue/CPublic::zip;
m_ImagetoCompare.Draw(pDC->m_hDC,m_Image.GetWidth()/CPublic::zip+1,0,width,height);
}
else
{
if (!m_Image.IsNull())
{
SetStretchBltMode(pDC->m_hDC, STRETCH_HALFTONE);
m_Image.StretchBlt(pDC->m_hDC,0,0,m_Image.GetWidth()*CPublic::m_ZoomValue,m_Image.GetHeight()*CPublic::m_ZoomValue,SRCCOPY);
}
}
POSITION pos = this->m_ComponentList.GetHeadPosition();
while (pos != NULL)
{
CComponent* pCmp =(CComponent *) this->m_ComponentList.GetNext(pos);
pCmp->ScaleDraw(CPublic::m_ZoomValue);
pCmp->Draw(pDC);
}
}
else
{
if (!this->m_ImagetoPrint.IsNull())
{
double width = CPublic::m_CurScaleValue*m_Image.GetWidth()*this->pPrintSetupDlg->m_editMagnification*10;
double height = CPublic::m_CurScaleValue*m_Image.GetHeight()*this->pPrintSetupDlg->m_editMagnification*10;
CBrush *pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));//获取透明画刷对象指针
CBrush *pOldBrush=pDC->SelectObject(pBrush);//将透明画刷选入DC
CPen
newPen(PS_SOLID,1,RGB(0,0,0));
pDC->SetBkMode(TRANSPARENT);
CPen *pOldPen = pDC->SelectObject(&newPen);
CRect rectCreater(100,-200,2000,-300);
CRect rectMang(rectCreater.left,rectCreater.top-1-abs(rectCreater.Height()),
rectCreater.right,rectCreater.bottom-1-abs(rectCreater.Height()));
CRect rectDes(rectMang.left,rectMang.top-1-abs(rectMang.Height()),
rectMang.right,rectMang.bottom-1-abs(rectMang.Height()));
pDC->DrawText("Creater",&rectCreater,DT_EXTERNALLEADING);
CString strTemp="Magnification";
pDC->DrawText(strTemp,&rectMang,DT_EXTERNALLEADING);
strTemp.Format("%d",pPrintSetupDlg->m_editMagnification);
pDC->DrawText("Description",&rectDes,DT_EXTERNALLEADING);
pDC->MoveTo(rectCreater.left,rectCreater.top);
pDC->LineTo(rectCreater.left,rectCreater.top-2500);
pDC->LineTo(rectCreater.right,rectCreater.top-2500);
pDC->LineTo(rectCreater.right,rectCreater.top);
pDC->LineTo(rectCreater.left,rectCreater.top);
pDC->MoveTo(rectDes.left,rectDes.bottom);
pDC->LineTo(rectDes.right,rectDes.bottom);
pDC->MoveTo(rectCreater.left + 300,rectCreater.top);
pDC->LineTo(rectCreater.left + 300,rectCreater.top-300);
pDC->MoveTo(rectCreater.left,rectCreater.bottom);
pDC->LineTo(rectCreater.right,rectCreater.bottom);
pDC->MoveTo(rectMang.left,rectMang.bottom);
pDC->LineTo(rectMang.right,rectMang.bottom);
pDC->MoveTo(rectCreater.left,rectCreater.top+100);
pDC->LineTo(rectCreater.right,rectCreater.top+100);
pDC->MoveTo(rectCreater.left,rectCreater.top+100);
pDC->LineTo(rectCreater.left,rectCreater.top);
pDC->MoveTo(rectCreater.right,rectCreater.top+100);
pDC->LineTo(rectCreater.right,rectCreater.top);
pDC->TextOut(rectCreater.left+800,-102,pPrintSetupDlg->m_editTitle);
pDC->TextOut(rectCreater.left+302,rectCreater.top-2,pPrintSetupDlg->m_editCreater);
pDC->TextOut(rectMang.left+302,rectMang.top-2,strTemp);
pDC->TextOut(rectDes.left+302,rectDes.top-2,pPrintSetupDlg->m_editDescription);
SetStretchBltMode(pDC->m_hDC, STRETCH_HALFTONE);
m_ImagetoPrint.StretchBlt(pDC->m_hDC,rectDes.left+10,rectDes.bottom-10,width,-height,SRCCOPY);
pDC->SelectObject(pOldBrush);
pDC->SelectObject(pOldPen);
}
}
//pDC->SelectObject(pOldFont);
// pDC->SelectObject(pOldPen);
}