📄 testseledlg.cpp
字号:
this->m_EditModulusMin=int (curContent->m_DifficultModulusMin*100)+1;
this->m_EditModulusMax=int(curContent->m_DifficultModulusMax*100)+1;
this->m_EditTestScore=curContent->m_Score;//试题总分数
}
else
{
int index=m_TestTypeListbox.GetCurSel();
if(index<0)return;
m_TestTypeListbox.GetText(index,m_CurTestType);//试题类型
this->m_EditTestNum=1;//试题数目
//试题难度系数范围
this->m_EditModulusMin=11;
this->m_EditModulusMax=100;
this->m_EditTestScore=1;//试题总分数
}
UpdateData(FALSE);
}
void CTestSeleDlg::_SetTesttypeItemState()
{
int count=m_TestTypeListbox.GetCount();
for(int j=0;j<count;j++)
{
CString text;
m_TestTypeListbox.GetText(j,text);
int len=m_TestRecordArray.GetSize();
for(int i=0;i<len;i++)
{
TestContent *tcontent=m_TestRecordArray.GetAt(i);
if(tcontent->m_TestType1==text)
{
m_TestTypeListbox.SetCheck(j,2);
break;
}
}
}
}
void CTestSeleDlg::_ReadPaperInforToListControl()
{
m_TestSeleInfoListctrl.DeleteAllItems();
int len=m_TestRecordArray.GetSize();
int totalscore=0;
for(int i=0;i<len;i++)
{
int index = m_TestSeleInfoListctrl.InsertItem(m_TestSeleInfoListctrl.GetItemCount(),"图层");
m_TestSeleInfoListctrl.SetItemData(index, index+1);
TestContent*tpArray=m_TestRecordArray.GetAt(i);
m_TestSeleInfoListctrl.SetItemText(i,0,tpArray->m_TestType1);
CString Test;
Test.Format("%d",tpArray->m_Score);
m_TestSeleInfoListctrl.SetItemText(i,1,Test);
Test.Format("%f",tpArray->m_AverageModulus);
m_TestSeleInfoListctrl.SetItemText(i,2,Test);
Test.Format("%d",tpArray->m_TestNum);
m_TestSeleInfoListctrl.SetItemText(i,3,Test);
totalscore+=tpArray->m_Score;
}
UpdateData(TRUE);
m_EditPaperTotalScore=totalscore;
UpdateData(FALSE);
}
void CTestSeleDlg::OnChangeEditDiffcultModulusMin()
{
UpdateData(TRUE);
m_EditModulusMin=m_SpinModulusMin.GetPos();
UpdateData(FALSE);
if(m_EditModulusMax<m_EditModulusMin)
{
m_EditModulusMax=m_EditModulusMin;
m_SpinModulusMax.SetPos(m_EditModulusMax);
}
UpdateData(FALSE);
}
void CTestSeleDlg::OnChangeEditDiffcultModulusMax()
{
UpdateData(TRUE);
m_EditModulusMax=m_SpinModulusMax.GetPos();
UpdateData(FALSE);
if(m_EditModulusMax<m_EditModulusMin)
{
m_EditModulusMin=m_EditModulusMax;
m_SpinModulusMin.SetPos(m_EditModulusMin);
}
UpdateData(FALSE);
}
void CTestSeleDlg::OnButtonViewTestPaper()
{
// TODO: Add your control notification handler code here
int paperNum=((CWordPadApp*)AfxGetApp())->m_PaperNum;
CString PapaerNum;
PapaerNum.Format("%d",paperNum);
CString PapaerName="试题";
CString PaperExt=".rtf";
CString PaperFileName;
if(paperNum!=0)
PaperFileName=PapaerName+PapaerNum+PaperExt;
else
PaperFileName=PapaerName+PaperExt;
CFile filelist;
if(filelist.Open(PaperFileName,CFile::modeCreate | CFile::modeWrite)==FALSE)
return;
((CWordPadApp*)AfxGetApp())->m_PaperNum++;
CArchive ar(&filelist,CArchive::store);
ar.WriteString(" 测绘科大函授2000--2001学年第一学期 试题 B 卷\r\n");
ar.WriteString(" 课程名称:自然资源分析与评价 年级专业:98信息工程 学号: 姓名:\r\n");
ar.WriteString("_________________________________________________________________________________\r\n");
if(!m_TestDB.IsOpen())
m_TestDB.Open(AFX_DAO_USE_DEFAULT_TYPE,NULL,0);
int len=m_TestRecordArray.GetSize();
for(int i=0;i<len;i++)
{
m_TestDB.MoveFirst();
TestContent*curContent=m_TestRecordArray.GetAt(i);
ar.WriteString("\r\n");
//题目标题
CString temp=_NumToChineseTile(i+1);
CString Title1=temp+curContent->m_TestType1+"\r\n";
ar.WriteString(Title1);
int length=curContent->m_SelectArray2.GetSize();
for(int j=0;j<length;j++)
{
int kk=curContent->m_SelectArray2.GetAt(j);
int k=0;
CString temp1;
temp1.Format("%d",j+1);
m_TestDB.MoveFirst();
while(!m_TestDB.IsEOF())
{
if(k==kk)
{
CString Question=" "+temp1+". "+m_TestDB.m_column3;
ar.WriteString(Question+"\r\n");
break;
}
m_TestDB.MoveNext();
k++;
}
}
}
m_TestDB.Close();
ar.Close();
filelist.Close();
((CWordPadApp*)AfxGetApp())->_OpenPaper(PaperFileName);
}
void CTestSeleDlg::_CalCurTestScore()
{
int index=_GetCurSelTestIndex();
if(index==-1)return ;
if(!m_TestDB.IsOpen())
m_TestDB.Open(AFX_DAO_USE_DEFAULT_TYPE,NULL,0);
m_TestDB.MoveFirst();
TestContent*curContent=m_TestRecordArray.GetAt(index);
int len=curContent->m_SelectArray2.GetSize();
int totelScor=0;
for(int i=0;i<len;i++)
{
int index=curContent->m_SelectArray2.GetAt(i);
int kk=0;
m_TestDB.MoveFirst();
while(!m_TestDB.IsEOF())
{
//题型判定
if(index==kk)
{
totelScor=totelScor+m_TestDB.m_column4;
break;
}
m_TestDB.MoveNext();
kk++;
}
}
curContent->m_Score=totelScor;
}
CString CTestSeleDlg::_NumToChineseTile(int testno)
{
if(testno==1)
return "一、";
if(testno==2)
return "二、";
if(testno==3)
return "三、";
if(testno==4)
return "四、";
if(testno==5)
return "五、";
if(testno==6)
return "六、";
if(testno==7)
return "七、";
if(testno==8)
return "八、";
if(testno==9)
return "九、";
if(testno==10)
return "十、";
if(testno==11)
return "十一、";
if(testno==12)
return "十二、";
if(testno==13)
return "十三、";
if(testno==14)
return "十四、";
if(testno==15)
return "十五、";
if(testno==16)
return "十六、";
if(testno==17)
return "十七、";
if(testno==18)
return "十八、";
if(testno==19)
return "十九、";
if(testno==20)
return "二十、";
return "";
}
void CTestSeleDlg::OnChangeEditTestnum()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CTestSeleDlg::OnOutofmemorySpinTestnum(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
}
void CTestSeleDlg::OnChangeEditTestType()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CTestSeleDlg::OnChangeEditTestTotalScore()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CTestSeleDlg::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
void CTestSeleDlg::OnSelchangeListKnowldgepiont()
{
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -