BOOL SetColumn( int nCol, const LVCOLUMN* pColumn ); typedef struct _LVCOLUMN { UINT mask; int fmt; int cx; LPTSTR pszText; int cchTextMax; int iSubItem; #if (_WIN32_IE >= 0x0300) int iImage; int iOrder; #endif #if (_WIN32_WINNT >= 0x0600) int cxMin; int cxDefault; int cxIdeal; #endif } LVCOLUMN, *LPLVCOLUMN; cx Width of the column, in pixels.
错误 59 error C2039: 'SetRowHeigt' : is not a member of 'CListCtrl' e:\vc2005\2010mtd\2010mtd\calibdlg.cpp 138 --------------------------------------------------------------------------
int nCol,
const LVCOLUMN* pColumn
);
typedef struct _LVCOLUMN {
UINT mask;
int fmt;
int cx;
LPTSTR pszText;
int cchTextMax;
int iSubItem;
#if (_WIN32_IE >= 0x0300)
int iImage;
int iOrder;
#endif
#if (_WIN32_WINNT >= 0x0600)
int cxMin;
int cxDefault;
int cxIdeal;
#endif
} LVCOLUMN, *LPLVCOLUMN;
cx
Width of the column, in pixels.
http://www.vckbase.com/document/viewdoc/?id=1855m_ListCtrl.SetColColor(0,RGB(10,150,20)); //设置列背景色
m_ListCtrl.SetColColor(2,RGB(30,100,90)); //设置列背景色
m_ListCtrl.SetBkColor(RGB(50,10,10)); //设置背景色
m_ListCtrl.SetItemColor(1,1,RGB(100,100,10)); //设置指定单元背景色
m_ListCtrl.SetRowHeigt(25); //设置行高度
m_ListCtrl.SetHeaderHeight(1.5); //设置头部高度
m_ListCtrl.SetHeaderFontHW(16,0); //设置头部字体高度,和宽度,0表示缺省,自适应
m_ListCtrl.SetHeaderTextColor(RGB(255,200,100)); //设置头部字体颜色
m_ListCtrl.SetTextColor(RGB(0,255,255)); //设置文本颜色
m_ListCtrl.SetHeaderBKColor(100,255,100,8); //设置头部背景色
m_ListCtrl.SetFontHW(15,0); //设置字体高度,和宽度,0表示缺省宽度
m_ListCtrl.SetColTextColor(2,RGB(255,255,100)); //设置列文本颜色
m_ListCtrl.SetItemTextColor(3,1,RGB(255,0,0)); //设置单元格字体颜色
LRESULT OnLayout( WPARAM wParam, LPARAM lParam ),之后手动添加消息响应ON_MESSAGE(HDM_LAYOUT, OnLayout),在消息响应中改变高度,实现代码如下: LRESULT CHeaderCtrlCl::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;
int nHeight = (int)(pwpos->cy * m_Height); //改变高度,m_Height为倍数
pwpos->cy = nHeight;
prc->top = nHeight;
return lResult;
--------------------------------------------------------------------------
{
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_Height);
pwpos->cy = nHeight;
prc->top = nHeight;
return lResult;
}