资源简介
实现了添加,删除,查看,修改等功能,用着还可以,界面很朴素,课设作业
代码片段和文件信息
// Listview.cpp : implementation file
//
#include “stdafx.h“
#include “学生管理系统.h“
#include “Listview.h“
#include “学生管理系统Doc.h“//
#include “student.h“//
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CListview
IMPLEMENT_DYNCREATE(CListview CListView)
CListview::CListview()
{
m_nstu=0;
m_show=TRUE;
}
CListview::~CListview()
{
}
BEGIN_MESSAGE_MAP(CListview CListView)
//{{AFX_MSG_MAP(CListview)
ON_NOTIFY_REFLECT(NM_CLICK onclick)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CListview drawing
void CListview::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CListview diagnostics
#ifdef _DEBUG
void CListview::AssertValid() const
{
CListView::AssertValid();
}
void CListview::Dump(CDumpContext& dc) const
{
CListView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CListview message handlers
void CListview::OnInitialUpdate()
{
CListView::OnInitialUpdate();
if(m_show)//打开文件时避免重设置标题头
{
CListCtrl& m_ListCtrl=GetListCtrl();//
SetCtrlstyle(m_ListCtrl.m_hWndLVS_REPORT);//设置显示方式
m_ListCtrl.SetExtendedstyle(LVS_EX_FULLROWSELECT);//选择整行
CString strHeader[5]={“学号““姓名““性别““专业““班级“};//创建列表控件标题头
int nWidth[5]={12010071100100};//设置宽度
for(int nCol=0;nCol<5;nCol++)
m_ListCtrl.InsertColumn(nColstrHeader[nCol]LVCFMT_CENTERnWidth[nCol]);//插入列
}
// TODO: Add your specialized code here and/or call the base class
}
void CListview::SetCtrlstyle(HWND hWnd DWORD dwNewstyle)//设置列表视图显示风格
{
DWORD dwoldstyle;
dwoldstyle=GetWindowLong(hWndGWL_style);//获取当前风格
if((dwoldstyle&LVS_TYPEMASK)!=dwNewstyle)
{
dwoldstyle&=~LVS_TYPEMASK;
dwNewstyle|=dwoldstyle;
SetWindowLong(hWndGWL_styledwNewstyle);//设置新风格
}
}
void CListview::OnUpdate(CView* pSender LPARAM lHint Cobject* pHint)
{
// TODO: Add your specialized code here and/or call the base class
CMyDoc* pDoc = (CMyDoc*)GetDocument();
ASSERT_VALID(pDoc);
CListCtrl& m_ListCtrl=GetListCtrl();
if(lHint==1)
{
m_ListCtrl.DeleteAllItems(); //避免重复显示
m_show=FALSE;
int nCount=pDoc->m_stu.GetSize();
for(int i=0;i {
Cstudent *pstu=(Cstudent*)(pDoc->m_stu.GetAt(i));
m_ListCtrl.InsertItem(0““);
m_ListCtrl.SetItemText(00pstu->num);
m_ListCtrl.SetItemText(01pstu->name);
m_ListCtrl.SetItemText(02pstu->sex);
m_ListCtrl.SetItemText(03pstu->major);
m_ListCtrl.SetItemText(04pstu->class1);
}
}
if(lHint==2)
{
m_ListCtrl.DeleteAllItems(); //避免重复显示
Cstudent *pst=(Cstudent*)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3343 2010-03-31 21:03 学生管理系统\学生管理系统.clw
文件 4385 2009-12-29 10:00 学生管理系统\ReadMe.txt
文件 1336 2009-12-29 10:00 学生管理系统\学生管理系统.h
文件 214 2009-12-29 10:00 学生管理系统\StdAfx.cpp
文件 532 2009-12-29 10:00 学生管理系统\学生管理系统.dsw
文件 140288 2010-03-31 21:03 学生管理系统\学生管理系统.ncb
文件 2516 2010-03-31 21:02 学生管理系统\学生管理系统.plg
文件 1727 2009-12-29 11:00 学生管理系统\MainFrm.h
文件 1178 2009-12-29 11:00 学生管理系统\StdAfx.h
文件 4955 2009-12-29 12:10 学生管理系统\学生管理系统.dsp
文件 4493 2009-12-30 14:03 学生管理系统\学生管理系统.cpp
文件 754 2009-12-30 15:06 学生管理系统\student.h
文件 889 2009-12-30 15:06 学生管理系统\student.cpp
文件 1150 2009-12-30 15:06 学生管理系统\Resource.h
文件 83 2009-12-30 15:55 学生管理系统\无标题
文件 1613 2009-12-31 16:10 学生管理系统\Listview.h
文件 2232 2009-12-31 16:12 学生管理系统\学生管理系统Doc.cpp
文件 30116 2010-03-31 21:02 学生管理系统\学生管理系统.aps
文件 13000 2010-01-01 13:24 学生管理系统\学生管理系统.rc
文件 3369 2010-01-06 20:09 学生管理系统\MainFrm.cpp
文件 2465 2010-01-06 21:08 学生管理系统\学生管理系统View.h
文件 4218 2010-01-06 21:08 学生管理系统\Listview.cpp
文件 1622 2010-01-06 21:08 学生管理系统\学生管理系统Doc.h
文件 9270 2010-01-06 21:08 学生管理系统\学生管理系统View.cpp
文件 404 2009-12-29 10:00 学生管理系统\res\学生管理系统.rc2
文件 1078 2009-12-29 10:00 学生管理系统\res\学生管理系统Doc.ico
文件 1078 2009-12-29 10:00 学生管理系统\res\学生管理系统.ico
文件 1078 2009-12-29 10:00 学生管理系统\res\Toolbar.bmp
文件 53760 2010-03-31 21:03 学生管理系统\学生管理系统.opt
目录 0 2010-03-31 21:01 学生管理系统\res
............此处省略4个文件信息
- 上一篇:VC++开发GIS系统代码陈建春书
- 下一篇:国密SM3摘要算法工具
评论
共有 条评论