描述:
我想通过活动文档服务器把程序中的通过图片的方式显示在Word这样的包容器中,但是我绘制的CDC的其它函数都可以正常显示,可以图片去不行,急救!
BOOL CTestSrvrItem::OnDraw(CDC* pDC, CSize& rSize)
{
// Remove this if you use rSize
UNREFERENCED_PARAMETER(rSize);
CTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: set mapping mode and extent
// (The extent is usually the same as the size returned from OnGetExtent)
// TODO: add drawing code here. Optionally, fill in the HIMETRIC extent.
// All drawing takes place in the metafile device context (pDC).
// TODO: also draw embedded CNetMakerCntrItem objects.
// The following code draws the first item at an arbitrary position.
// TODO: remove this code when your real drawing code is complete
// POSITION pos = pDoc->GetStartPosition();
// CNetMakerCntrItem* pItem = (CNetMakerCntrItem*)pDoc->GetNextClientItem(pos);
// if (pItem != NULL)
// pItem->Draw(pDC, CRect(10, 10, 1010, 1010));
int xLogPixPerInch = pDC->GetDeviceCaps(LOGPIXELSX);
int yLogPixPerInch = pDC->GetDeviceCaps(LOGPIXELSY);
pDC->SetMapMode(MM_TEXT);
// pDC->SetWindowExt(1024,768);
// pDC->SetViewportExt( 1024,768);
// pDC->SetWindowOrg(0,0);
pDC->TextOut(100,10,"Edraw document");
CDC memDC;
memDC.CreateCompatibleDC (pDC);
CBitmap memBitmap;
memBitmap.LoadBitmap(IDB_TITLE);
CBitmap *pOldBit = memDC.SelectObject (&memBitmap);
pDC->BitBlt (100,100,200,200,&memDC,0,0,SRCCOPY);
memDC.SelectObject (pOldBit);
memDC.DeleteDC ();
memBitmap.DeleteObject ();
return TRUE;
}