.h中
CListCtrl m_list;
.cpp中
在Dialog的OnInitDialog函数中
m_list.InsertColumn(0,"aa",LVCFMT_CENTER,155);
m_list.InsertItem(1,"强迫能量不可用率");
m_list.InsertItem(2,"单极强迫停运率");
m_list.InsertItem(3,"部分双极停运率");
m_list.InsertItem(4,"双极停运强迫停运率");
m_list.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); 但是没有反应,怎么办呀?

解决方案 »

  1.   

    是不是焦点不在ListCtrl上?
    把ListCtrl的资源属性设置为“一直显示选择”,或者用程序加上LVS_SHOWSELALWAYS风格。
      

  2.   

    哈哈,虽然坐的是板凳还是有机会抢到分了,这个原因是因为在OnInitialDialog中对话框还没创建,LISTCTROL也没创建,可以在OnInitialDialog返回之前PostMessage一个自定义消息,在该自定义消息中加入m_list.SetCurSel(0);
      

  3.   

    同意一楼
    listctrl添加属性always show selection
      

  4.   

    listctrl添加属性always   show   selection;然后在SetItemState();上面的各位同志,CListCtrl就沒有SetCurSel()的成員函數的。
      

  5.   

    反对2楼!
    改变tab顺序,在layout->tab order,将你的ListControl 改为1