📄 colorlistctrl.cpp
字号:
// ColorListCtrl.cpp: implementation of the CColorListCtrl class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ColorListCtrl.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CColorListCtrl::CColorListCtrl()
{
}
CColorListCtrl::~CColorListCtrl()
{
}
LRESULT CColorListCtrl::OnCustomDraw(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
NMLVCUSTOMDRAW* pLVCD = (NMLVCUSTOMDRAW *)pnmh;
LRESULT pResult = S_OK;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
pResult = CDRF_NOTIFYITEMDRAW;
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
int nItem = pLVCD->nmcd.dwItemSpec ;
pLVCD->clrTextBk = (COLORREF)GetItemData(nItem);
if (pLVCD->clrTextBk == RGB(128,128,128) || pLVCD->clrTextBk == RGB(128,128,0))
pLVCD->clrText = RGB(255,255,255);
else
pLVCD->clrText = pLVCD->clrTextBk^RGB(255,255,255);
pResult = CDRF_DODEFAULT;
}
return pResult;
}
HWND CColorListCtrl::Create(HWND hParent, _U_RECT rc, UINT nID)
{
RECT rect = *rc.m_lpRect;
HWND hWnd = CWindowImpl<CColorListCtrl,CListViewCtrl>::Create(hParent, rect);
SetWindowLong(GWL_ID,nID);
return hWnd;
}
BOOL CColorListCtrl::SetItemBkColor(int nItem, COLORREF crItemBk)
{
ATLASSERT(IsWindow());
if(m_hWnd == NULL)
return FALSE;
return SetItemData(nItem,crItemBk);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -