📄 listctrl.cpp
字号:
// ListCtrl.cpp : implementation file
//
// this class is an override of the default clistctrl
// this version provides handlers to allow modifying the
// subitem on repeated selection of the item in the list
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
//#include "HouseholdManger.h"
#include "resource.h"
#include "ListCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFieldListCtrl
CFieldListCtrl::CFieldListCtrl()
{
}
CFieldListCtrl::~CFieldListCtrl()
{
}
BEGIN_MESSAGE_MAP(CFieldListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CFieldListCtrl)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFieldListCtrl message handlers
void CFieldListCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
UINT flags;
int item = HitTest(point, &flags);
if (item != -1)
{
CString text = GetItemText(item, 1);
if (text != "")
{
if (text == _T("ascending"))
{
SetItemText(item, 1, _T("descending"));
SetItemState(item, 1, LVIS_SELECTED);
CListCtrl::OnLButtonDown(nFlags, point);
}
else
{
SetItemText(item, 1, _T(""));
SetItemState(item, 0, LVIS_SELECTED);
}
}
else
{
SetItemText(item, 1, _T("ascending"));
SetItemState(item, 1, LVIS_SELECTED);
CListCtrl::OnLButtonDown(nFlags, point);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -