⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 studentwinview.cpp

📁 一个简单的学生学籍管理工具。vc编写。 有喜欢的可以批评指正^_^
💻 CPP
📖 第 1 页 / 共 3 页
字号:
Cstudent*pstudent;
POSITION pold;

pold=pDoc->curpos;
POSITION p;
int k=0;
p=pDoc->m_dataList.GetHeadPosition();
if(p==NULL)
{
}
else{
//////////////////

Cstudent*modal;
pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
while(pDoc->curpos!=NULL)
{	
pstudent=pDoc->m_dataList.GetAt(pDoc->curpos);
studentall[k]=pstudent;
pDoc->m_dataList.GetNext(pDoc->curpos);
k++;
if(pDoc->curpos==NULL)
break;
}
for(int p=0;p<k;p++)
studentoldall[p]=studentall[p];
for(int i=0;i<k;i++)
{
for(int j=0;j<k;j++)
{
	if(studentall[i]->id<studentall[j]->id)
	{
modal=studentall[j];
studentall[j]=studentall[i];
studentall[i]=modal;
	}
}
}
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentall[l]);
//////////////
}
Cdoubledlg dlg;
dlg.pDoc=pDoc;
dlg.dlgtype=1;
dlg.couter=much;
dlg.cursor=cursor;
dlg.DoModal();
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentoldall[l]);	

pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
cursor=1;
	pstudent=pDoc->m_dataList.GetAt(pDoc->curpos);
	m_id=pstudent->id;
	m_name=pstudent->name;
	m_year=pstudent->year;
	m_intyue=pstudent->yue;
	m_intdate=pstudent->date;
	m_addr=pstudent->addr;
	m_tel=pstudent->tel;
	m_intsex=pstudent->sex;
	m_score1=pstudent->lesson[0].name;
	m_fen1=pstudent->lesson[0].fen;
m_score2=pstudent->lesson[1].name;
	m_fen2=pstudent->lesson[1].fen;
m_score3=pstudent->lesson[2].name;
	m_fen3=pstudent->lesson[2].fen;
m_score4=pstudent->lesson[3].name;
	m_fen4=pstudent->lesson[3].fen;
setstatusbar();
	UpdateData(false);
}
void CStudentwinView::Onlessonfind() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
POSITION p=pDoc->curpos;
Cfinddlg dlg;
dlg.kind=4;
dlg.pDoc=pDoc;
dlg.DoModal();
pDoc->curpos=p;		
}

void CStudentwinView::Onnamefind() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
POSITION p=pDoc->curpos;
Cfinddlg dlg;
dlg.kind=1;
dlg.pDoc=pDoc;
dlg.DoModal();
pDoc->curpos=p;	
}

void CStudentwinView::Onoldfind() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
POSITION p=pDoc->curpos;
Cfinddlg dlg;
dlg.kind=3;
dlg.pDoc=pDoc;
dlg.DoModal();
pDoc->curpos=p;		
}

void CStudentwinView::Onyearfinddown() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
Cstudent*pstudent;
POSITION pold;
int k=0;
pold=pDoc->curpos;
POSITION p;
p=pDoc->m_dataList.GetHeadPosition();
if(p==NULL)
{
}
else{
//////////////////

Cstudent*modal;
pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
while(pDoc->curpos!=NULL)
{	
pstudent=pDoc->m_dataList.GetAt(pDoc->curpos);
studentall[k]=pstudent;
pDoc->m_dataList.GetNext(pDoc->curpos);
k++;
if(pDoc->curpos==NULL)
break;
}
for(int p=0;p<k;p++)
studentoldall[p]=studentall[p];
for(int i=0;i<k;i++)
{
for(int j=0;j<k;j++)
{
	if(2002-studentall[i]->year>2002-studentall[j]->year)
	{
modal=studentall[j];
studentall[j]=studentall[i];
studentall[i]=modal;
	}
}
}
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentall[l]);
//////////////
}
Cdoubledlg dlg;
dlg.pDoc=pDoc;
dlg.dlgtype=1;
dlg.couter=much;
dlg.cursor=cursor;
dlg.DoModal();
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentoldall[l]);	

pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
cursor=1;
pstudent=pDoc->m_dataList.GetAt(pDoc->curpos);
	m_id=pstudent->id;
	m_name=pstudent->name;
	m_year=pstudent->year;
	m_intyue=pstudent->yue;
	m_intdate=pstudent->date;
	m_addr=pstudent->addr;
	m_tel=pstudent->tel;
	m_intsex=pstudent->sex;
	m_score1=pstudent->lesson[0].name;
	m_fen1=pstudent->lesson[0].fen;
m_score2=pstudent->lesson[1].name;
	m_fen2=pstudent->lesson[1].fen;
m_score3=pstudent->lesson[2].name;
	m_fen3=pstudent->lesson[2].fen;
m_score4=pstudent->lesson[3].name;
	m_fen4=pstudent->lesson[3].fen;
setstatusbar();
	UpdateData(false);		
}

void CStudentwinView::Onyearfindup() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
Cstudent*pstudent;
POSITION pold;
int k=0;
pold=pDoc->curpos;
POSITION p;
p=pDoc->m_dataList.GetHeadPosition();
if(p==NULL)
{
}
else{
//////////////////

Cstudent*modal;
pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
while(pDoc->curpos!=NULL)
{	
pstudent=pDoc->m_dataList.GetAt(pDoc->curpos);
studentall[k]=pstudent;
pDoc->m_dataList.GetNext(pDoc->curpos);
k++;
if(pDoc->curpos==NULL)
break;
}
for(int p=0;p<k;p++)
studentoldall[p]=studentall[p];
for(int i=0;i<k;i++)
{
for(int j=0;j<k;j++)
{
	if(2002-studentall[i]->year<2002-studentall[j]->year)
	{
modal=studentall[j];
studentall[j]=studentall[i];
studentall[i]=modal;
	}
}
}
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentall[l]);
//////////////
}
Cdoubledlg dlg;
dlg.pDoc=pDoc;
dlg.dlgtype=1;
dlg.couter=much;
dlg.cursor=cursor;
dlg.DoModal();
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentoldall[l]);	
pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
cursor=1;

pstudent=pDoc->m_dataList.GetAt(pDoc->curpos);
	m_id=pstudent->id;
	m_name=pstudent->name;
	m_year=pstudent->year;
	m_intyue=pstudent->yue;
	m_intdate=pstudent->date;
	m_addr=pstudent->addr;
	m_tel=pstudent->tel;
	m_intsex=pstudent->sex;
	m_score1=pstudent->lesson[0].name;
	m_fen1=pstudent->lesson[0].fen;
m_score2=pstudent->lesson[1].name;
	m_fen2=pstudent->lesson[1].fen;
m_score3=pstudent->lesson[2].name;
	m_fen3=pstudent->lesson[2].fen;
m_score4=pstudent->lesson[3].name;
	m_fen4=pstudent->lesson[3].fen;
	setstatusbar();
	UpdateData(false);	
}

void CStudentwinView::Onzhifang() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);

POSITION phead;
phead=pDoc->m_dataList.GetHeadPosition();
if(phead==NULL)
{
	MessageBox("无信息");
}else{
POSITION	p=pDoc->curpos;
Cbitmapdlg dlg;
dlg.couter=much;
dlg.pDoc=pDoc;
dlg.type=1;
dlg.DoModal();
pDoc->curpos=p;}
}

void CStudentwinView::Onaddrfind() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
POSITION p=pDoc->curpos;
Cfinddlg dlg;
dlg.kind=2;
//dlg.counter=much;
dlg.pDoc=pDoc;
dlg.DoModal();
pDoc->curpos=p;		
}

void CStudentwinView::Onbingzhuang() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
POSITION phead;
phead=pDoc->m_dataList.GetHeadPosition();
if(phead==NULL)
{
	MessageBox("无信息");
}else{
POSITION p=pDoc->curpos;
Cbitmapdlg dlg;
dlg.pDoc=pDoc;
dlg.type=2;
dlg.DoModal();	
pDoc->curpos=p;
}
}



void CStudentwinView::Ondouble() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);

/*if(m_dlg!=NULL)
{
m_dlg->pDoc=pDoc;
move=true;
m_dlg->couter=much;
m_dlg->cursor=cursor;
m_dlg->open=open;
m_dlg->ShowWindow(SW_SHOW);
UpdateData(false);
}else{
*/
m_dlg=new Cdoubledlg(this);
POSITION	p=pDoc->curpos;
m_dlg->pDoc=pDoc;
move=true;
m_dlg->couter=much;
m_dlg->cursor=cursor;
m_dlg->open=open;
m_dlg->Create(IDD_doubleview,this);
m_dlg->ShowWindow(SW_SHOW);
pDoc->curpos=p;
UpdateData(false);


//}
//}
pDoc->UpdateAllViews(this);

}

void CStudentwinView::OnTimer(UINT nIDEvent) 
{
if(doublerect.left<=-400)
{
doublerect.left=10;
doublerect.right=410;
doublerect.top=70;
doublerect.bottom=570;
KillTimer(m_ntimer2);
}else{
doublerect.left-=20;
doublerect.right-=20;
m_dlg->MoveWindow(doublerect);
}

	CFormView::OnTimer(nIDEvent);
}

void CStudentwinView::OnStatichelp() 
{
//CStdioFile filehelp;
CString strfile;
strfile=filepath+"\\Banzhu.hlp";
//filehelp.Open(strfile,CFile::modeCreate|CFile::modeReadWrite);
//filehelp.WriteString("                      静态帮助\n");
//filehelp.WriteString(" 静态帮助\n");
//filehelp.Close();
//CString str;

::WinHelp(this->m_hWnd,strfile,HELP_FINDER,0);
//str="notepad "+strfile;
//::WinExec(str,SW_SHOW);
		
}

void CStudentwinView::OnAutohelp() 
{

	::ShellExecute(NULL,"open","http://202.196.32.6/",NULL,NULL,SW_SHOW);
}

void CStudentwinView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) 
{
pDC->SetMapMode(MM_LOENGLISH);	
	CFormView::OnPrepareDC(pDC, pInfo);
}

void CStudentwinView::printfoot(CDC *pDC)
{

}

void CStudentwinView::printhead(CDC *pDC, CPrintInfo *pInfo)
{

}

void CStudentwinView::OnFenhui() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
POSITION p;
p=pDoc->curpos;
Cstudent *pstudent;
	
int k=0;
p=pDoc->m_dataList.GetHeadPosition();
if(p==NULL)
{
}
else{
//////////////////

Cstudent*modal;
pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
while(pDoc->curpos!=NULL)
{	
pstudent=pDoc->m_dataList.GetAt(pDoc->curpos);
studentall[k]=pstudent;
pDoc->m_dataList.GetNext(pDoc->curpos);
k++;
if(pDoc->curpos==NULL)
break;
}
for(int p=0;p<k;p++)
studentoldall[p]=studentall[p];
for(int i=0;i<k;i++)
{
for(int j=0;j<k;j++)
{
	if((studentall[i]->lesson[0].fen+studentall[i]->lesson[1].fen+studentall[i]->lesson[2].fen+studentall[i]->lesson[3].fen)<(studentall[j]->lesson[0].fen+studentall[j]->lesson[1].fen+studentall[j]->lesson[2].fen+studentall[j]->lesson[3].fen))
	{
modal=studentall[j];
studentall[j]=studentall[i];
studentall[i]=modal;
	}
}
}
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentall[l]);
//////////////
}
Cdoubledlg dlg;
dlg.pDoc=pDoc;
dlg.dlgtype=3;
dlg.couter=much;
dlg.cursor=cursor;
dlg.DoModal();
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentoldall[l]);	
pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
cursor=1;
UpdateData(false);
}

void CStudentwinView::OnIdhui() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
POSITION p;
p=pDoc->curpos;
Cstudent *pstudent;
	
int k=0;
p=pDoc->m_dataList.GetHeadPosition();
if(p==NULL)
{
}
else{
//////////////////

Cstudent*modal;
pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
while(pDoc->curpos!=NULL)
{	
pstudent=pDoc->m_dataList.GetAt(pDoc->curpos);
studentall[k]=pstudent;
pDoc->m_dataList.GetNext(pDoc->curpos);
k++;
if(pDoc->curpos==NULL)
break;
}
for(int p=0;p<k;p++)
studentoldall[p]=studentall[p];
for(int i=0;i<k;i++)
{
for(int j=0;j<k;j++)
{
	if(studentall[i]->id<studentall[j]->id)
	{
modal=studentall[j];
studentall[j]=studentall[i];
studentall[i]=modal;
	}
}
}
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentall[l]);
//////////////
}
Cdoubledlg dlg;
dlg.pDoc=pDoc;
dlg.dlgtype=3;
dlg.couter=much;
dlg.cursor=cursor;
dlg.DoModal();
pDoc->m_dataList.RemoveAll();
for(int l=0;l<k;l++)
pDoc->m_dataList.AddTail(studentoldall[l]);	
pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
cursor=1;
}

void CStudentwinView::Onshezhi() 
{

UpdateData();
switch(kechengcouter)
{
case 0:
m_score1=m_kecheng;	
break;
case 1:
m_score2=m_kecheng;	
break;
case 2:
m_score3=m_kecheng;	
break;
case 3:
m_score4=m_kecheng;	
m_editkecheng.SetReadOnly(true);
break;
}
kechengcouter++;
UpdateData(false);
}

void CStudentwinView::Onnewshezhi() 
{
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
pDoc->m_dataList.RemoveAll();
pDoc->curpos=NULL;
much=0;
cursor=0;
kechengcouter=0;
m_addr = _T("");
m_fen1 = 0;
m_id=0;
	m_fen2 = 0;
	m_fen3 = 0;
	m_fen4 = 0;
	m_score1="";
	m_score2="";
	m_score3="";
	m_score4="";
	m_name = _T("");
	m_tel = 0;
	m_year = 0;
	m_intyue = -1;
	m_intdate = -1;
	m_intsex = -1;
UpdateData(false);
setstatusbar();
DeleteFile(filepath+"\\学生库.txt");
DeleteFile(filepath+"\\课程库.txt");
DeleteFile(filepath+"\\成绩库.txt");
m_editkecheng.SetReadOnly(false);	

}

void CStudentwinView::OnKillfocusid() 
{
/*	UpdateData();
CStudentwinDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
Cstudent*pstudent;
pDoc->curpos=pDoc->m_dataList.GetHeadPosition();
while(pDoc->curpos!=NULL)
{
pstudent=pDoc->m_dataList.GetAt(pDoc->curpos);
if(pstudent->id==m_id)
{
//MessageBox("学号重复,请重新输入学号");
//m_id=0;
//m_editid.SetFocus();
break;
}

pDoc->m_dataList.GetNext(pDoc->curpos);
if(pDoc->curpos==NULL)
break;
}*/	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -