資源簡介
實現了添加,刪除,查看,修改等功能,用著還可以,界面很樸素,課設作業

代碼片段和文件信息
//?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摘要算法工具
評論
共有 條評論