如题,我在后面或下一行加了问号的都是不知道啥意思或啥作用的。
void CACLEakage::OnSize(UINT nType, int cx, int cy) 
{
    CPropertyPage::OnSize(nType, cx, cy);
    // TODO: Add your message handler code here
    int nCount=listRect.GetCount();//?
    if(listRect.GetCount()>0)
    {
        CRect rectDlgNow;
        GetWindowRect(&rectDlgNow);
        POSITION mP = listRect.GetHeadPosition();//?
        CRect rectDlgSaved;
        rectDlgSaved = listRect.GetNext(mP);
        ScreenToClient(rectDlgSaved);//?
        ScreenToClient(rectDlgNow); 
        float fRateScaleX = (float)(rectDlgNow.right-rectDlgNow.left)/(rectDlgSaved.right-rectDlgSaved.left);
        //?
        float fRateScaleY = (float)(rectDlgNow.bottom-rectDlgNow.top)/(rectDlgSaved.bottom-rectDlgSaved.top);
        //?
        ClientToScreen(rectDlgSaved);//?
        ClientToScreen(rectDlgNow);
        LOGFONT stFont;
        ::GetObject((HFONT)GetStockObject(DEFAULT_GUI_FONT), sizeof(stFont), &stFont);//?
        strcpy(stFont.lfFaceName,"Franklin Gothic Medium");
        stFont.lfHeight = (long)(fRateScaleY*14);
        stFont.lfWidth = (long)(fRateScaleX*7);
        CFont * m_pCFont;
        m_pCFont = new CFont;
        m_pCFont->CreateFontIndirect(&stFont);//?
        CRect rectChildSaved;
        CWnd *pWndChild = GetWindow(GW_CHILD);//?
        while(pWndChild)
        {
            rectChildSaved = listRect.GetNext(mP);
            rectChildSaved.left = rectDlgNow.left+(int)((rectChildSaved.left-rectDlgSaved.left)* fRateScaleX);
            rectChildSaved.top = rectDlgNow.top+(int)((rectChildSaved.top-rectDlgSaved.top)*fRateScaleY);
            rectChildSaved.right = rectDlgNow.right+(int)((rectChildSaved.right-rectDlgSaved.right)*          fRateScaleX);//?
            rectChildSaved.bottom = rectDlgNow.bottom+(int)((rectChildSaved.bottom-rectDlgSaved.bottom)* fRateScaleY);//?
            ScreenToClient(rectChildSaved);
            pWndChild->MoveWindow(rectChildSaved);//?
            pWndChild->SetFont(m_pCFont);//?
            pWndChild = pWndChild->GetNextWindow();//?
        }
    }
    Invalidate();
}新手,多谢帮助~如果你没空,觉得一行一行解释太浪费时间,就说个大概吧~~

解决方案 »

  1.   

    int nCount=listRect.GetCount();//?
    POSITION mP = listRect.GetHeadPosition();//?
    =============
    不知道listRect的定义,不好说,看代码像是CList之类,那么第一个是取列表中有多少个元素,后一句是取起始位置。ScreenToClient(rectDlgSaved);//?
    ClientToScreen(rectDlgSaved);//?
    =============
    一个是屏幕坐标转窗口坐标,一个是窗口坐标转屏幕坐标。float fRateScaleX = (float)(rectDlgNow.right-rectDlgNow.left)/(rectDlgSaved.right-rectDlgSaved.left);
    ==========================
    这个应该是变化后与变化前窗口水平大小的比值m_pCFont->CreateFontIndirect(&stFont);//?
    ===========
    这个是创建一个字体,具体去看MSDN
    后面的不想解释了,都是一些类的成员函数,自己去看一下MSDN就行了。
      

  2.   

    msdn或者把方法粘到google GetCount()获取你list多少列的 很多方法都可以通过字面意思理解的详细用法msdn