基類是CScrollView
程序是SDI
我在視圖中畫了文本,圖標,打印預覽都能正確顯示,打印時文本能打印出來,但圖標不能打印出來,哪里處問題了 ?我重載了OnPrePareDC() ,設置了座標映射.下面是OnPrePareDC() 部份代碼: CScrollView::OnPrepareDC(pDC, pInfo);
pDC->SetMapMode(MM_ANISOTROPIC);//修改坐標映射方式
CSize size = CSize(800,560);
    pDC->SetWindowExt(size);   
int xLogPixPerInch = pDC->GetDeviceCaps(LOGPIXELSX);
int yLogPixPerInch = pDC->GetDeviceCaps(LOGPIXELSY);
long xExt = (long)size.cx * xLogPixPerInch/96;
long yExt = (long)size.cy * xLogPixPerInch/96;
pDC->SetViewportExt((int)xExt,(int)yExt);
 ......
在OnDraw()中畫圖標和文本,下面是OnDraw()部份代碼: hIcon=(HICON)LoadImage (NULL,iconPath,IMAGE_ICON,48,48,LR_LOADFROMFILE|LR_DEFAULTSIZE);
DrawIconEx(pDC->GetSafeHdc(), x-24, y+50, hIcon, 48, 48, 0, NULL, DI_NORMAL);輸出文本
pDC->TextOut (x-35, y+110+linenum*20, stronetwo);
???怎麼解決

解决方案 »

  1.   

    那就用CBitmap把图标LOAD进来用BitBlt画上去试试
      

  2.   

    DrawIconEx is a USER32 function. Most likely, it uses raster opertions which are not supported by your printer.
      

  3.   

    to : FengYuanMSFT(袁峰 www.fengyuan.com)
    how to resolve this question?
      

  4.   

    1) Verify the problem first, download emf.exe from www.fengyuan.com to check EMF to see if ROPs are really being used.2) If ROPs are used, render the icon to a bitmap first and then print the bitmap. You will have some issues with transparent background.