zoukankan      html  css  js  c++  java
  • listctrl调整表头高度

    CListCtrl派生类下CMyListCtrl.h

    class CMyListCtrl :public CListCtrl
    {
        public:  
       // 设置表头高度
        void SetHeadHeight(float Height);
    }
    
    
    
    void CMyListCtrl::SetHeadHeight(float Height)
    {
        m_Head.m_fHeight = Height;
    }

    CHeaderCtrl派生类CMyHeadCtrl插入HDM_LAYOUT消息

    class CMyHeadCtrl :public CHeaderCtrl
    {
        LRESULT OnLayout(WPARAM wParam, LPARAM lParam);
    }
    
    BEGIN_MESSAGE_MAP(CMyHeadCtrl, CHeaderCtrl)
         ON_MESSAGE(HDM_LAYOUT, OnLayout)
    END_MESSAGE_MAP()
    
    CMyHeadCtrl::CMyHeadCtrl() : 
    {
    
        m_fHeight = 1.5;    //默认列头高度是一倍数
    }
    
    LRESULT CMyHeadCtrl::OnLayout(WPARAM wParam, LPARAM lParam)
    {
        LRESULT lResult = CHeaderCtrl::DefWindowProc(HDM_LAYOUT, 0, lParam);
        HD_LAYOUT &hdl = *(HD_LAYOUT *)lParam;
        RECT *prc = hdl.prc;
        WINDOWPOS *pwpos = hdl.pwpos;
    
        //表头高度为原来1.5倍,如果要动态修改表头高度的话,将1.5设成一个全局变量 
        int nHeight = (int)(pwpos->cy * m_fHeight);
        pwpos->cy = nHeight;
        prc->top = nHeight;
    
        return lResult;
    }
    赌上我的人生为梦想,即使是臭名远扬,也要我的名字响彻天堂
  • 相关阅读:
    MySQL-数据表操作
    MySQL基础命令
    Navicat 15激活
    禅道-启动失败问题整理
    python-开头的注释作用及区别
    SpringBoot、SpringCloud版本中GA/PRE/SNAPSHOT的详解
    mybatis的一些重要配置
    简历对应的知识点
    idea的破解
    SFTP和FTP的区别
  • 原文地址:https://www.cnblogs.com/ye-ming/p/7087270.html
Copyright © 2011-2022 走看看