m_bcenter这个bool型的变量,MFC中定义它的作用是什么

解决方案 »

  1.   

    你这个问题问的太宽泛了,m_bcenter只是一个BOOL型变量,不具有广义特征(MSDN中没找到)只能表示一个代表TRUE 和FALSE的变量
      

  2.   

    在VC98\MFC\SRC文件夹下的viewscrl.CPP文件中有这么一个函数void CScrollView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
    {
    ASSERT_VALID(pDC);#ifdef _DEBUG
    if (m_nMapMode == MM_NONE)
    {
    TRACE0("Error: must call SetScrollSizes() or SetScaleToFitSize()");
    TRACE0("\tbefore painting scroll view.\n");
    ASSERT(FALSE);
    return;
    }
    #endif //_DEBUG
    ASSERT(m_totalDev.cx >= 0 && m_totalDev.cy >= 0);
    switch (m_nMapMode)
    {
    case MM_SCALETOFIT:
    pDC->SetMapMode(MM_ANISOTROPIC);
    pDC->SetWindowExt(m_totalLog);  // window is in logical coordinates
    pDC->SetViewportExt(m_totalDev);
    if (m_totalDev.cx == 0 || m_totalDev.cy == 0)
    TRACE0("Warning: CScrollView scaled to nothing.\n");
    break; default:
    ASSERT(m_nMapMode > 0);
    pDC->SetMapMode(m_nMapMode);
    break;
    } CPoint ptVpOrg(0, 0);       // assume no shift for printing
    if (!pDC->IsPrinting())
    {
    ASSERT(pDC->GetWindowOrg() == CPoint(0,0)); // by default shift viewport origin in negative direction of scroll
    ptVpOrg = -GetDeviceScrollPosition(); if (m_bCenter)
    {
    CRect rect;
    GetClientRect(&rect); // if client area is larger than total device size,
    // override scroll positions to place origin such that
    // output is centered in the window
    if (m_totalDev.cx < rect.Width())
    ptVpOrg.x = (rect.Width() - m_totalDev.cx) / 2;
    if (m_totalDev.cy < rect.Height())
    ptVpOrg.y = (rect.Height() - m_totalDev.cy) / 2;
    }
    }
    pDC->SetViewportOrg(ptVpOrg); CView::OnPrepareDC(pDC, pInfo);     // For default Printing behavior
    }如果不知道m_bCenter的含义和初值,怎么确定这段话的意思呢
      

  3.   

    output是否要在window的center输出
      

  4.   

    人家注释不是说的很清楚么:如果客户区大于总的设备尺寸,调整窗口原点使得它居中显示。
    这些英语不那么难吧?即使有一两个生词,字典查查也不难
    // if client area is larger than total device size, 
    // override scroll positions to place origin such that 
    // output is centered in the window