int hg = rect1.Height() - (rect1.bottom - rect2.bottom);
m_List1.SetWindowPos(NULL,rect1.left, rect1.top, rect1.Width(),hg, TRUE );你的那个只是将大小改成一样的

解决方案 »

  1.   

    MoveWindow,等来计算大小位置,调整
      

  2.   


    CRect   rect1; 
    m_List1.GetClientRect(rect1); 
    CRect   rect2; 
    m_List2.GetClientRect(rect2);
      

  3.   


    CRect   rect1; 
    m_List1.GetClientRect(rect1); 
    CRect   rect2; 
    m_List2.GetClientRect(rect2);

    要求的是 左顶右不变,把底对齐。
      

  4.   

    为什么是
    rect2.top+rect2.Height()
    而不是
    rect2.top+rect1.Height()
    呢?rect2.top+rect2.Height() 并不会改变 list2 的 bottom 啊……深深地不理解
      

  5.   

    还有 
    m_List1.SetWindowPos(NULL,rect1.left, rect1.top, rect1.Width(),i, TRUE );
    这里的 i 计算出来是 bottom,可是 SetWindowPos 的参数要求是 height 啊
      

  6.   


    //列表框1比列表框2高 
    CRect   rect1; 
    m_List1.GetWindowRect(rect1);//得到的屏幕坐标  
    CRect   rect2; 
    m_List2.GetWindowRect(rect2);//得到的屏幕坐标  ScreenToClient(rect1);
    ScreenToClient(rect2);
    if (0 != rect1.bottom - rect2.bottom)
    {
    int hg = rect1.Height() - (rect1.bottom - rect2.bottom); 
    m_List1.SetWindowPos(&wndTop,rect1.left, rect1.top, rect1.Width(),hg, SWP_SHOWWINDOW );
    }