如何改变CListCtrl中默认的行高度?

解决方案 »

  1.   

    在ListCtrl所在的对话框中重载此函数:
    CYouDlg::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) 
    {
    // TODO: Add your message handler code here and/or call default
    if(nIDCtl == IDC_YOU_LIST)
    {
    lpMeasureItemStruct->itemHeight = 20;
    }
    }
    记得给分呀!
      

  2.   

    typedef struct tagMEASUREITEMSTRUCT {
        UINT   CtlType;
        UINT   CtlID;
        UINT   itemID;
        UINT   itemWidth;
        UINT   itemHeight;
        DWORD  itemData
    } MEASUREITEMSTRUCT;CtlTypeContains the control type. The values for control types are as follows: ODT_COMBOBOX   Owner-draw combo box
    ODT_LISTBOX   Owner-draw list box
    ODT_MENU   Owner-draw menu 
    CtlIDContains the control ID for a combo box, list box, or button. This member is not used for a menu.itemIDContains the menu-item ID for a menu or the list-box-item ID for a variable-height combo box or list box. This member is not used for a fixed-height combo box or list box, or for a button.itemWidthSpecifies the width of a menu item. The owner of the owner-draw menu item must fill this member before it returns from the message.itemHeightSpecifies the height of an individual item in a list box or a menu. Before it returns from the message, the owner of the owner-draw combo box, list box, or menu item must fill out this member. The maximum height of a list box item is 255.