VS的界面代码又不公开,最多也就是授权一些第三方的代码然后给你,比如VS2008SP1/VS2010加入了BCG的哪些东西

解决方案 »

  1.   


    CRect m_rect;// CXXDlg::OnInitDialog()函数中
    CRect rect;
    CRect rc; GetClientRect(&rect);
    m_list.GetWindowRect(&rc);
    ScreenToClient(&rc); m_rect.left = rc.left - rect.left;
    m_rect.top = rc.top - rect.top;
    m_rect.right = rect.right - rc.right;
    m_rect.bottom = rect.bottom - rc.bottom;// WM_SIZE消息响应函数OnSize中
    void CXXXDlg::OnSize(UINT nType, int cx, int cy) 
    {
    CDialog::OnSize(nType, cx, cy);

    // TODO: Add your message handler code here
    if(m_list.GetSafeHwnd())
    {
    CRect rect;
    GetClientRect(&rect);
    CRect rc;
    rc.left = rect.left + m_rect.left;
    rc.top = rect.top + m_rect.top;
    rc.right = rect.right - m_rect.right;
    rc.bottom = rect.bottom - m_rect.bottom;
    m_list.MoveWindow(&rc);
    }
    }
      

  2.   


    你这段代码有点问题,编绎可以通过,但运行时,改变SIZE,LIST就变得无限大一样,也没有滚动条
      

  3.   

    VC6下没有问题
    CRect m_rect;BOOL CXXXDlg::OnInitDialog()
    {
    CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range.
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
    pSysMenu->AppendMenu(MF_SEPARATOR);
    pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
    } // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE); // Set big icon
    SetIcon(m_hIcon, FALSE); // Set small icon

    // TODO: Add extra initialization here
    m_list.ModifyStyle(0, LVS_REPORT);
    m_list.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT); m_list.InsertColumn(0, _T("AA"), LVCFMT_LEFT, 100);
    m_list.InsertColumn(1, _T("BB"), LVCFMT_LEFT, 100); for(int i=0; i<50; i++)
    {
    CString str;
    str.Format(_T("%d - Hello - %d"), i, i);
    m_list.InsertItem(i, _T(""));
    m_list.SetItemText(i, 0, str);
    m_list.SetItemText(i, 1, str);
    } CRect rect;
    CRect rc; GetClientRect(&rect);
    m_list.GetWindowRect(&rc);
    ScreenToClient(&rc); m_rect.left = rc.left - rect.left;
    m_rect.top = rc.top - rect.top;
    m_rect.right = rect.right - rc.right;
    m_rect.bottom = rect.bottom - rc.bottom;

    return TRUE;  // return TRUE  unless you set the focus to a control
    }void CXXXDlg::OnSize(UINT nType, int cx, int cy) 
    {
    CDialog::OnSize(nType, cx, cy);

    // TODO: Add your message handler code here
    if(m_list.GetSafeHwnd())
    {
    CRect rect;
    GetClientRect(&rect);
    CRect rc;
    rc.left = rect.left + m_rect.left;
    rc.top = rect.top + m_rect.top;
    rc.right = rect.right - m_rect.right;
    rc.bottom = rect.bottom - m_rect.bottom;
    m_list.MoveWindow(&rc);
    }
    }
      

  4.   

    你的CListCtrl是不是属性设置的不对?或者是否自绘了?
      

  5.   

    在VS的安装目录下有一个叫Samples的文件夹,打开,解压里面VC的压缩文件
    在解压出来的目录下MFC\Visual C++ 2008 Feature Pack\VisualStudioDemo
    是一个VisualStudio的界面DEMO,可以看一下
      

  6.   

    可以发一份给我吗?我在微软的网站上下载了这个FEATURE的补丁,但是我装不上去,我用的VS2008,SP1,WIN7系统,而单独的这个DEMO我找不到呀,下载不到单独的
      

  7.   

    你装了SP1以后,在你的VS2008的安装文件路径下Samples/1033/...下面