怎么变大?

解决方案 »

  1.   

    HBITMAP *hBitmap; //定义位图对象句柄 
    hBitmap=(HBITMAP*)::LoadImage( AfxGetInstanceHandle(),"tmp.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE); 
    CBitmap bmp;
    CDC dcMemory;
    if (bmp.Attach(hBitmap))
    {
    // Get the size of the bitmap
    BITMAP bmpInfo;
    bmp.GetBitmap(&bmpInfo);
    // Create an in-memory DC compatible with the
    // display DC we're using to paint
    dcMemory.CreateCompatibleDC(&memDC);
    // Select the bitmap into the in-memory DC
    CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);
    // Find a centerpoint for the bitmap in the client area
    CRect rect;
    // Copy the bits from the in-memory DC into the on-
    // screen DC to actually do the painting. Use the centerpoint
    // we computed for the target offset.
    memDC.BitBlt(1,200, bmpInfo.bmWidth*25, bmpInfo.bmHeight*25, &dcMemory,0, 0, BLACKNESS);
    dcMemory.SelectObject(pOldBitmap);
    }
      

  2.   

    bitblt的参数错了,坐标需要转换,好像是这个SetMapMode(hMemDC,MM_ANISOTROPIC); ,记不清楚了,不好意思啊。打印坐标系和显示坐标系要一个转换
      

  3.   

    这个问题是这样解决的,因为windows的打印的坐标系统合你位图的坐标系统不是一一对应的,位图采用的是像素,而打印机采用其他坐标,最好查一查GDI坐标转换的例子那里介绍的很清楚。
      

  4.   

    假定你是在 View 中使用打印
    按下面的做OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) 
    {
    //设定自动用户调节比例的映射模式
    pDC->SetMapMode(MM_ANISOTROPIC);

    CRect rcClient;
    GetClientRect(rcClient);

    CSize size(rcClient.right,rcClient.right);

    //设定当前的窗口
    pDC->SetWindowExt(size);

    //获取当前显示设备(显示器/打印机)每英寸中包含的象素点个数
    int xLogPixPerInch = pDC->GetDeviceCaps(LOGPIXELSX);
    int yLogPixPerInce = pDC->GetDeviceCaps(LOGPIXELSY);

    int xExt;
    int yExt;
    xExt = size.cx * xLogPixPerInch / 96 ;  // 96 为屏幕显示的每英寸象素数目
    yExt = size.cy * yLogPixPerInce / 96 ;

    pDC->SetViewportExt(xExt,yExt);
    }
    OK  再试试吧,搞定了