MFC中改变list control满足条件的某一行的背景颜色


改变list control满足一定条件的某一行的背景颜色的习例。
资源截图
代码片段和文件信息
// listcontrol.cpp : Defines the class behaviors for the application.
//

#include “stdafx.h“
#include “listcontrol.h“

#include “MainFrm.h“
#include “listcontrolDoc.h“
#include “listcontrolView.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CListcontrolApp

BEGIN_MESSAGE_MAP(CListcontrolApp CWinApp)
//{{AFX_MSG_MAP(CListcontrolApp)
ON_COMMAND(ID_APP_ABOUT OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
//    DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CListcontrolApp construction

CListcontrolApp::CListcontrolApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CListcontrolApp object

CListcontrolApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CListcontrolApp initialization

BOOL CListcontrolApp::InitInstance()
{
AfxEnableControlContainer();

// Standard initialization
// If you are not using these features and wish to reduce the size
//  of your final executable you should remove from the following
//  the specific initialization routines you do not need.

#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T(“Local AppWizard-Generated Applications“));

LoadStdProfileSettings();  // Load standard INI file options (including MRU)

// Register the application‘s document templates.  Document templates
//  serve as the connection between documents frame windows and views.

CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINframe
RUNTIME_CLASS(CListcontrolDoc)
RUNTIME_CLASS(CMainframe)       // main SDI frame window
RUNTIME_CLASS(CListcontrolView));
AddDocTemplate(pDocTemplate);

// Parse command line for standard shell commands DDE file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;

// The one and only window has been initialized so show and update it.
m

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-07-15 16:14  listcontrol
     目录           0  2013-07-15 16:14  listcontrolDebug
     文件      118886  2013-07-15 16:51  listcontrolDebuglistcontrol.exe
     文件      359096  2013-07-15 16:51  listcontrolDebuglistcontrol.ilk
     文件       23482  2013-07-15 16:29  listcontrolDebuglistcontrol.obj
     文件     5498060  2013-07-15 16:21  listcontrolDebuglistcontrol.pch
     文件      492544  2013-07-15 16:51  listcontrolDebuglistcontrol.pdb
     文件        7624  2013-07-15 16:35  listcontrolDebuglistcontrol.res
     文件       15236  2013-07-15 16:21  listcontrolDebuglistcontrolDoc.obj
     文件       20250  2013-07-15 16:21  listcontrolDebuglistcontrolView.obj
     文件       23313  2013-07-15 16:42  listcontrolDebugMainFrm.obj
     文件      105933  2013-07-15 16:21  listcontrolDebugStdAfx.obj
     文件       18537  2013-07-15 16:51  listcontrolDebug estdlg.obj
     文件      214016  2013-07-15 16:51  listcontrolDebugvc60.idb
     文件      364544  2013-07-15 16:51  listcontrolDebugvc60.pdb
     文件       44932  2013-07-15 16:35  listcontrollistcontrol.aps
     文件        2782  2013-07-15 16:58  listcontrollistcontrol.clw
     文件        4299  2013-07-15 16:14  listcontrollistcontrol.cpp
     文件        4786  2013-07-15 16:52  listcontrollistcontrol.dsp
     文件         547  2013-07-15 16:14  listcontrollistcontrol.dsw
     文件        1411  2013-07-15 16:14  listcontrollistcontrol.h
     文件       58368  2013-07-15 17:08  listcontrollistcontrol.ncb
     文件       49664  2013-07-15 17:08  listcontrollistcontrol.opt
     文件        1237  2013-07-15 16:51  listcontrollistcontrol.plg
     文件       12348  2013-07-15 16:35  listcontrollistcontrol.rc
     文件        1842  2013-07-15 16:14  listcontrollistcontrolDoc.cpp
     文件        1530  2013-07-15 16:14  listcontrollistcontrolDoc.h
     文件        2729  2013-07-15 16:14  listcontrollistcontrolView.cpp
     文件        1971  2013-07-15 16:14  listcontrollistcontrolView.h
     文件        2563  2013-07-15 16:29  listcontrolMainFrm.cpp
     文件        1474  2013-07-15 16:25  listcontrolMainFrm.h
............此处省略12个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)