请问各位:
     如何让列表框中的某一行保持选中状态除非选中另一行?

解决方案 »

  1.   

    CListBox::SetCurSel 
    int SetCurSel( int nSelect );Return ValueLB_ERR if an error occurs.ParametersnSelectSpecifies the zero-based index of the string to be selected. If nSelect is –1, the list box is set to have no selection.ResSelects a string and scrolls it into view, if necessary. When the new string is selected, the list box removes the highlight from the previously selected string. Use this member function only with single-selection list boxes. It cannot be used to set or remove a selection in a multiple-selection list box.
      

  2.   

    属性里有一项是:always show select类似的话吧,打钩就好了
    不行就ModifyStyle里加进去
      

  3.   

    用程序控制中列表框中的某一行:
    m_clistctrl.SetItemState(nCurItem,   LVIS_SELECTED,   LVIS_SELECTED);   
    m_clistctrl.SetFocus();//要加上这一行
      

  4.   

    哎呀,不好意思,可能是我表达的不清楚,即使增加了一行,还是选中原来选中那行,,可能应该这样问比较清楚一点,,,,如何改变某一行的背景颜色和字体颜色,在CListCtrl中?
      

  5.   

    int nSelect 为你选中的行; nSelect=((CListBox*)GetDlgItem(IDC_LIST_COven))->GetCurSel(); ((CListBox*)GetDlgItem(IDC_LIST_COven))->SetCurSel( int nSelect );
      

  6.   


    CListCtrl也可以这样用么?
      

  7.   

    int nSelect 为你选中的行;nSelect=((CListBox*)GetDlgItem(IDC_LIST_COven))->GetCurSel();((CListBox*)GetDlgItem(IDC_LIST_COven))->SetCurSel( int nSelect );
      

  8.   


    CListCtrl 好像不能这样用哦