使用ListBox的一个小问题,如何使ListBox在ListBox.InsertString(最后一行)或ListBox.AddrString()后,滚动条自动滚到最下面一行的位置!?

解决方案 »

  1.   

    我每次ListBox.InsertString(最后一行)或ListBox.AddrString()后,滚动条自动是自动到第一行的位置的。我想让滚动条自动到最下面一行的位置。
      

  2.   

    int SetScrollPos(    HWND hWnd, // handle of window with scroll bar
        int nBar, // scroll bar flag
        int nPos, // new position of scroll box
        BOOL bRedraw  // redraw flag
       );用这个api
      

  3.   

    EnsureVisible(nItem, FALSE);
      

  4.   

    SetCaretIndex(nItem, FALSE);
      

  5.   

    CListBox m_list;
             static int a=1;
    CString str;int b=0;
    str.Format("第%d条",a++);
    m_list.InsertString(m_list.GetCount(),str);
    b=m_list.GetCount();
    //m_list.SetFocus();
    m_list.SetCurSel(b-1);
    这样每次输入数据后,数据自动成为最后一条,而且选中的也是当前插入的这条
      

  6.   

    加玩设置选择第一行SetCurSel(0)