-
大小: 56KB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2021-06-06
- 語(yǔ)言: C/C++
- 標(biāo)簽:
資源簡(jiǎn)介
實(shí)現(xiàn)了添加,刪除,查看,修改等功能,用著還可以,界面很樸素,課設(shè)作業(yè)

代碼片段和文件信息
//?Listview.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“學(xué)生管理系統(tǒng).h“
#include?“Listview.h“
#include?“學(xué)生管理系統(tǒng)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)//打開(kāi)文件時(shí)避免重設(shè)置標(biāo)題頭
{
CListCtrl&?m_ListCtrl=GetListCtrl();//
SetCtrlstyle(m_ListCtrl.m_hWndLVS_REPORT);//設(shè)置顯示方式
m_ListCtrl.SetExtendedstyle(LVS_EX_FULLROWSELECT);//選擇整行
CString?strHeader[5]={“學(xué)號(hào)““姓名““性別““專業(yè)““班級(jí)“};//創(chuàng)建列表控件標(biāo)題頭
int?nWidth[5]={12010071100100};//設(shè)置寬度
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)//設(shè)置列表視圖顯示風(fēng)格
{??
????DWORD?dwoldstyle;
????dwoldstyle=GetWindowLong(hWndGWL_style);//獲取當(dāng)前風(fēng)格
if((dwoldstyle&LVS_TYPEMASK)!=dwNewstyle)
{
dwoldstyle&=~LVS_TYPEMASK;
dwNewstyle|=dwoldstyle;
SetWindowLong(hWndGWL_styledwNewstyle);//設(shè)置新風(fēng)格
}
}
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();?//避免重復(fù)顯示
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();?//避免重復(fù)顯示
Cstudent?*pst=(Cstudent*)
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????3343??2010-03-31?21:03??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).clw
?????文件???????4385??2009-12-29?10:00??學(xué)生管理系統(tǒng)\ReadMe.txt
?????文件???????1336??2009-12-29?10:00??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).h
?????文件????????214??2009-12-29?10:00??學(xué)生管理系統(tǒng)\StdAfx.cpp
?????文件????????532??2009-12-29?10:00??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).dsw
?????文件?????140288??2010-03-31?21:03??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).ncb
?????文件???????2516??2010-03-31?21:02??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).plg
?????文件???????1727??2009-12-29?11:00??學(xué)生管理系統(tǒng)\MainFrm.h
?????文件???????1178??2009-12-29?11:00??學(xué)生管理系統(tǒng)\StdAfx.h
?????文件???????4955??2009-12-29?12:10??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).dsp
?????文件???????4493??2009-12-30?14:03??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).cpp
?????文件????????754??2009-12-30?15:06??學(xué)生管理系統(tǒng)\student.h
?????文件????????889??2009-12-30?15:06??學(xué)生管理系統(tǒng)\student.cpp
?????文件???????1150??2009-12-30?15:06??學(xué)生管理系統(tǒng)\Resource.h
?????文件?????????83??2009-12-30?15:55??學(xué)生管理系統(tǒng)\無(wú)標(biāo)題
?????文件???????1613??2009-12-31?16:10??學(xué)生管理系統(tǒng)\Listview.h
?????文件???????2232??2009-12-31?16:12??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng)Doc.cpp
?????文件??????30116??2010-03-31?21:02??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).aps
?????文件??????13000??2010-01-01?13:24??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).rc
?????文件???????3369??2010-01-06?20:09??學(xué)生管理系統(tǒng)\MainFrm.cpp
?????文件???????2465??2010-01-06?21:08??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng)View.h
?????文件???????4218??2010-01-06?21:08??學(xué)生管理系統(tǒng)\Listview.cpp
?????文件???????1622??2010-01-06?21:08??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng)Doc.h
?????文件???????9270??2010-01-06?21:08??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng)View.cpp
?????文件????????404??2009-12-29?10:00??學(xué)生管理系統(tǒng)\res\學(xué)生管理系統(tǒng).rc2
?????文件???????1078??2009-12-29?10:00??學(xué)生管理系統(tǒng)\res\學(xué)生管理系統(tǒng)Doc.ico
?????文件???????1078??2009-12-29?10:00??學(xué)生管理系統(tǒng)\res\學(xué)生管理系統(tǒng).ico
?????文件???????1078??2009-12-29?10:00??學(xué)生管理系統(tǒng)\res\Toolbar.bmp
?????文件??????53760??2010-03-31?21:03??學(xué)生管理系統(tǒng)\學(xué)生管理系統(tǒng).opt
?????目錄??????????0??2010-03-31?21:01??學(xué)生管理系統(tǒng)\res
............此處省略4個(gè)文件信息
評(píng)論
共有 條評(píng)論