列表视在初始化的时候可以排满一行,但是这时我再最大化窗口它就排不满了。
比如:有20个图标,开始窗口处于非最大状态,这时图标排成 5 行 4 列,当我最大化窗口时我想让它变为 4 行 5 列 或者2行 十列,总之我想让它在任何时候尽量排满每一行,我该怎么做呢?

解决方案 »

  1.   

    BOOL CListCtrl::Arrange( UINT nCode );
    nCodeLVA_ALIGNLEFT   Aligns items along the left edge of the window.
    LVA_ALIGNTOP   Aligns items along the top edge of the window.
    LVA_DEFAULT   Aligns items according to the list view’s current alignment styles (the default value).LVA_SNAPTOGRID   Snaps all icons to the nearest grid position.
      

  2.   

    Arrange的参数就可以了.LVA_SNAPTOGRID
      

  3.   

    我是这样做的但好像不行,代码如下:
    void CRecorderView::OnViewRefresh() 
    {
    // TODO: Add your command handler code here
    BOOL bSuccess;
    CListCtrl& listCtrl=GetListCtrl();
    bSuccess=listCtrl.Arrange(LVA_SNAPTOGRID);
    UpdateData();
    }
      

  4.   

    应该在resize()中添加你上面的代码
      

  5.   

    应该在resize()中添加你上面的代码