BOOL FirstPage::OnInitDialog() 
{
   CDialog::OnInitDialog();

// TODO: Add extra initialization here
// The following code will enumerate all the files in the 
// current directory, printing the name of each file:
    m_nFileIndex.InsertColumn(0,"¿Î³ÌºÅ");
    m_nFileIndex.InsertColumn(1,"¿Î³ÌÀà±ð");
    m_nFileIndex.InsertColumn(2,"¿Î³ÌÖÐÎÄÃû³Æ");
    m_nFileIndex.InsertColumn(3,"¿Î³ÌÓ¢ÎÄÃû³Æ");
    m_nFileIndex.InsertColumn(4,"¿Î³ÌÃèÊö");
    m_nFileIndex.InsertColumn(5,"¿Î³Ìѧʱ");
    m_nFileIndex.InsertColumn(6,"½Ì²Ä");
    m_nFileIndex.InsertColumn(7,"µÈЧ¿Î³Ì");
    m_nFileIndex.InsertColumn(8,"Ô¤Ð޿γÌ");
    m_nFileIndex.InsertColumn(9,"³õѵ/¸´Ñµ±êÖ¾");
    m_nFileIndex.InsertColumn(10,"¿ª¿Î²¿ÃÅ");
}

解决方案 »

  1.   

    m_lstCtrl.InsertColumn(0,_T("条屏名称"),LVCFMT_LEFT,80);
    m_lstCtrl.InsertColumn(1,_T("地址"),LVCFMT_LEFT,80);
    m_lstCtrl.InsertColumn(2,_T("颜色类型"),LVCFMT_LEFT,80);
    m_lstCtrl.InsertColumn(3,_T("扫描类型"),LVCFMT_LEFT,80);
    m_lstCtrl.InsertColumn(4,_T("宽度"),LVCFMT_LEFT,80);
    m_lstCtrl.InsertColumn(5,_T("高度"),LVCFMT_LEFT,80);从你的代码中不太能确定是什么问题。是不是没有设置列宽度。你只是看不到列。而实际上是插入了的。
      

  2.   

    这回也不行啊?
    BOOL FirstPage::OnInitDialog() {
       CDialog::OnInitDialog();

    // TODO: Add extra initialization here
    // The following code will enumerate all the files in the 
    // current directory, printing the name of each file:
        m_nFileIndex.InsertColumn(0,"j");
        m_nFileIndex.InsertColumn(1,"a");
        m_nFileIndex.InsertColumn(2,"b");
        m_nFileIndex.InsertColumn(3,"c");
        m_nFileIndex.InsertColumn(4,"d");
        m_nFileIndex.InsertColumn(5,"e");
        m_nFileIndex.InsertColumn(6,"f");
        m_nFileIndex.InsertColumn(7,"g");
        m_nFileIndex.InsertColumn(8,"h");
        m_nFileIndex.InsertColumn(9,"i");
        m_nFileIndex.InsertColumn(10,"h");
        RECT rect;
        m_nFileIndex.GetWindowRect(&rect);
        int wid = rect.right - rect.left;
        m_nFileIndex.SetColumnWidth(0, wid/11);
        m_nFileIndex.SetColumnWidth(1, wid/11);
        m_nFileIndex.SetColumnWidth(2, wid/11);
        m_nFileIndex.SetColumnWidth(3, wid/11);
        m_nFileIndex.SetColumnWidth(4, wid/11);
        m_nFileIndex.SetColumnWidth(5, wid/11);
        m_nFileIndex.SetColumnWidth(6, wid/11);
        m_nFileIndex.SetColumnWidth(7, wid/11);
        m_nFileIndex.SetColumnWidth(8, wid/11);
        m_nFileIndex.SetColumnWidth(9, wid/11);
        m_nFileIndex.SetColumnWidth(10, wid/11);
        m_nFileIndex.SetExtendedStyle(LVS_EX_FULLROWSELECT);  return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
    }
      

  3.   

    m_nFileIndex 是从哪获取的?
    看不明白阿
      

  4.   

    是和ListCtrl相关联的变量然后我用了由五个参数的那个InsertColumn函数,,第五个参数省略,还是没解决问题啊
      

  5.   

    没看你代码,觉得象listctrl这样的控健用法,以后就做个封装类,把所有这些乱七八糟的参数都封装起来,以后就不用麻烦了,要不每次都重新做,很烦人,下面是我做的一个用dao保存数据进入listctrl,你看看吧
    void CResorceData::RefreshData()
    {
    LV_ITEM ListItem;
    int iRow;
    int m_iFields;
    CString tempstr;
    COleVariant tempvar;
    m_resorcelistctrl.DeleteAllItems();
    CDaoRecordset rs(&theBase);
    CString strSQL;
    rs.Open(dbOpenDynaset,"select * from SJK");
    m_iFields = rs.GetFieldCount();


    if(!rs.IsEOF())
    {
    try
    {
    iRow=0; 
    ListItem.mask=LVIF_TEXT;
    rs.MoveFirst();
    while(!rs.IsEOF())
    {
    ListItem.iItem=iRow++;
    for(int i=0;i < 5;i++)
    {
    rs.GetFieldValue(StrColumnNames[i],tempvar);
    CCrack::VARIANTstr(tempvar,tempstr);
    ListItem.iSubItem=i;
    ListItem.pszText=tempstr.GetBuffer(100);
    m_resorcelistctrl.InsertItem(&ListItem);
    m_resorcelistctrl.SetItemText(ListItem.iItem,ListItem.iSubItem,ListItem.pszText);

    }
    rs.MoveNext();

    }
    }
    catch(CDaoException *e)
    {
    CSurveyApp::DisplayDaoException(e);
    e->Delete();
    }
    }
    rs.Close();
    }
      

  6.   

    CCrack::VARIANTstr(tempvar,tempstr);
    这个CCrack是专门负责数据转换的封装类
    #if !defined(AFX_CRACK_H__894E3242_D5D9_4A79_ACFE_611204416816__INCLUDED_)
    #define AFX_CRACK_H__894E3242_D5D9_4A79_ACFE_611204416816__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    //完成 COleVariant 类型到各个常见类型的转换
    //不必深究
    .h
    class CCrack  
    {  
    public:
    static void strVARIANT(const CString &strValue,int iType,COleVariant& Var);
    static COleDateTime strDateTime(const CString &strDateTime);
    static COleDateTime strDate(const CString &strDate);
    static COleDateTime strTime(const CString &strTime);
    static CString strBOOL(bool flag);
    static void VARIANTstr(const COleVariant& var,CString &cs,int idatetime=0);
    };#endif // !defined(AFX_CRACK_H__894E3242_D5D9_4A79_ACFE_611204416816__INCLUDED_)
    .cpp
    // Crack.cpp: implementation of the CCrack class.
    //
    //////////////////////////////////////////////////////////////////////#include "stdafx.h"
    #include "Survey.h"
    #include "Crack.h"#ifdef _DEBUG
    #undef THIS_FILE
    static char THIS_FILE[]=__FILE__;
    #define new DEBUG_NEW
    #endif//////////////////////////////////////////////////////////////////////
    // Construction/Destruction
    //////////////////////////////////////////////////////////////////////
    void CCrack::VARIANTstr(const COleVariant &var,CString &cs,int idatetime)
    {
    static int i=0;
    if((i++)==6)
    i=0;
    switch(var.vt)
    {
    case VT_EMPTY:
    case VT_NULL:cs=_T("");break;
    case VT_I2:cs.Format(_T("%hd"),V_I2(&var));break;
    case VT_I4:cs.Format(_T("%d"),V_I4(&var));break;
    case VT_R4:cs.Format(_T("%e"),(double)V_R4(&var));break;
    case VT_R8:cs.Format(_T("%e"),(double)V_R8(&var));break;
    case VT_CY:cs=COleCurrency(var).Format();break;
    case VT_DATE:
    switch(idatetime) {
    case 0:
    cs=COleDateTime(var).Format(_T("%H:%M:%S"));
    case 1:
    cs=COleDateTime(var).Format(_T("%Y-%m-%d"));
    case 2:
    cs=COleDateTime(var).Format(_T("%Y-%m-%d %H:%M:%S"));
    }

    break;
        case VT_BSTR:cs=V_BSTRT(&var);break;
    case VT_BOOL:cs=strBOOL(V_BOOL(&var));break;
    }}CString CCrack::strBOOL(bool flag)
    {
    CString strRet=(flag?"是":"否");
    return strRet;
    }
    //strTime格式:HH:MM:SS
    COleDateTime CCrack::strTime(const CString &strTime)
    {
    static COleDateTime retTime;
    static int iHour;
    static int iMinuter;
    static int iSecond;
    //retTime=COleDateTime::GetCurrentTime();//初始化Date=当前日期(因为在CClock中进行时间比较时,要比较日期
    sscanf(strTime.Left(2),"%d",&iHour);//得到时
    sscanf(strTime.Mid(3,2),"%d",&iMinuter);//分
    sscanf(strTime.Mid(6,2),"%d",&iSecond);//秒
    retTime.SetTime(iHour,iMinuter,iSecond);
    return retTime;
    }
    //strDate格式 YYYY/MM/DD
    COleDateTime CCrack::strDate(const CString &strDate)
    {
    static COleDateTime retTime;
    static int iYear;
    static int iMonth;
    static int iDay;
    sscanf(strDate.Left(4),"%d",&iYear);
    sscanf(strDate.Mid(5,2),"%d",&iMonth);
    sscanf(strDate.Mid(8,2),"%d",&iDay);
    retTime.SetDate(iYear,iMonth,iDay);
    return retTime;
    }
    //strDateTime格式 YYYY/MM/DD HH:MM:SS
    COleDateTime CCrack::strDateTime(const CString &strDateTime)
    {
    static COleDateTime retTime;
        static int iYear;
    static int iMonth;
    static int iDay;
    static int iHour;
    static int iMinuter;
    static int iSecond;
    sscanf(strDateTime.Left(4),"%d",&iYear);
    sscanf(strDateTime.Mid(5,2),"%d",&iMonth);
    sscanf(strDateTime.Mid(8,2),"%d",&iDay);
    sscanf(strDateTime.Mid(11,2),"%d",&iHour);//得到时
    sscanf(strDateTime.Mid(14,2),"%d",&iMinuter);//分
    sscanf(strDateTime.Mid(17,2),"%d",&iSecond);//秒
    retTime.SetDateTime(iYear,iMonth,iDay,iHour,iMinuter,iSecond);
    return retTime;
    }
    //包含strDate|strTime
    void CCrack::strVARIANT(const CString &strValue,int iType,COleVariant &var)
    {
    static bool bl;
    static BYTE ba;
    static short st;
    static long ln;
    static float ft;
    static COleDateTime dt;
    static double db; switch(iType) 
    {
    case (dbBoolean):
    {
    if(strValue=="是")
    bl=true;
    else
    bl=false;
    var.Clear();
    var.ChangeType(VT_BOOL);
    var.boolVal=bl;
    }
    break;
    case (dbByte):////////////问题
    {
    ba=(BYTE)strValue.GetAt(0);
    var=COleVariant(ba);
    }
    break;
    case(dbInteger):
    {
    st=(short)atoi((LPCTSTR)strValue);
    var=COleVariant(st,VT_I2);
    }
    break;
    case(dbLong):
    {
    long ln=(long)atol((LPCTSTR)strValue);
    var=COleVariant(ln);
    }
    break;
    case(dbSingle):
    {
    float ft=float(atof((LPCTSTR)strValue));
    var=COleVariant(ft);
    }
    break;
    case(dbDouble):
    {
    double db=(double)atof((LPCTSTR)strValue);
    var=COleVariant(db);
    }
    break;
    case(dbDate):
    {
    dt=strDate(strValue);
    var=COleVariant((DATE)dt);
    }
    break;
    case(dbText):
    case(dbMemo):
    {
    var=COleVariant(strValue,VT_BSTRT);//不能用VT_BSTR!!!!!!!
    }
    break;
    case( dbTime ):
    {
    dt=strTime(strValue);
    var=COleVariant((DATE)dt);
    }
    break;
    }
    }
      

  7.   

    zjz800800((对不起,偶是卧底)) 
    急需,要一行代码应个急啊
      

  8.   

    BOOL FirstPage::OnInitDialog() {
       CDialog::OnInitDialog();

    // TODO: Add extra initialization here
    // The following code will enumerate all the files in the 
    // current directory, printing the name of each file:
        m_nFileIndex.InsertColumn(0,"j");
        m_nFileIndex.InsertColumn(1,"a");
        m_nFileIndex.InsertColumn(2,"b");
        m_nFileIndex.InsertColumn(3,"c");
        m_nFileIndex.InsertColumn(4,"d");
        m_nFileIndex.InsertColumn(5,"e");
        m_nFileIndex.InsertColumn(6,"f");
        m_nFileIndex.InsertColumn(7,"g");
        m_nFileIndex.InsertColumn(8,"h");
        m_nFileIndex.InsertColumn(9,"i");
        m_nFileIndex.InsertColumn(10,"h");
        RECT rect;
        m_nFileIndex.GetWindowRect(&rect);
        int wid = rect.right - rect.left;
        m_nFileIndex.SetColumnWidth(0, wid/11);
        m_nFileIndex.SetColumnWidth(1, wid/11);
        m_nFileIndex.SetColumnWidth(2, wid/11);
        m_nFileIndex.SetColumnWidth(3, wid/11);
        m_nFileIndex.SetColumnWidth(4, wid/11);
        m_nFileIndex.SetColumnWidth(5, wid/11);
        m_nFileIndex.SetColumnWidth(6, wid/11);
        m_nFileIndex.SetColumnWidth(7, wid/11);
        m_nFileIndex.SetColumnWidth(8, wid/11);
        m_nFileIndex.SetColumnWidth(9, wid/11);
        m_nFileIndex.SetColumnWidth(10, wid/11);
        m_nFileIndex.SetExtendedStyle(LVS_EX_FULLROWSELECT);  return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
    }这个代码没问题,我测试过了
    是不是你没有把listctrl的风格设为report
      

  9.   

    你自己的代码也可以执行,没有错误,我想你应该是没有设listctrl的风格设为report,可以插入
      

  10.   

    请教下,为什么要设为report的
      

  11.   

    你所要完成的功能中用的listctrl可以好几种风格,你自己代码实现上就是这样完成所要的report风格的功能的,所以要将你的控健中的风格设为Report
      

  12.   

    用鼠标右健点listctrl控健,然后Styles->然后在view中选择Report就可以了
      

  13.   

    告诉你们原因吧:我的VC++是有BUG的,而我刚从昏迷中醒过来。
    现在重装完了,马上就显示了
      

  14.   

    就算你的vc没bug,如果你使用listctrl控健,将你上面所说的代码插入不设Styles为Report还能显示你就真的厉害了,呵呵