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

📄 unit13.pas

📁 试卷自动生成系统
💻 PAS
📖 第 1 页 / 共 3 页
字号:
 
   for j:=ListBox6.Items.Count-1 downto 0 do
   begin

    if ListBox1.Items[i]=ListBox6.Items[j] then
    begin
    ListBox6.Items.Delete(j);
  ListBox1.Items.Delete(i);
  Label2.Caption:='已选择 '+inttostr(ListBox1.Items.count)+'  题.          ';
        Label3.Caption:='还剩余 '+inttostr(definepaperform.choosenum-ListBox1.Items.count)+'  题.          ';

      break;
   end;

         end;

end;

end;

procedure Tchoosepaperform.BitBtn5Click(Sender: TObject);
var
j,i:integer;
begin
for i:=ListBox2.Items.Count-1 downto 0 do
 if ListBox2.Selected[i] then
 begin
     for j:=ListBox6.Items.Count-1 downto 0 do
   begin

    if ListBox2.Items[i]=ListBox6.Items[j] then
    begin
    ListBox6.Items.Delete(j);
  ListBox2.Items.Delete(i);
   Label5.Caption:='已选择 '+inttostr(ListBox2.Items.count)+'  题.          ';
        Label6.Caption:='还剩余 '+inttostr(definepaperform.judgenum-ListBox2.Items.count)+'  题.          ';

      break;
   end;

         end;

end;

end;


procedure Tchoosepaperform.BitBtn7Click(Sender: TObject);
var
j,i:integer;
begin
for i:=ListBox3.Items.Count-1 downto 0 do
 if ListBox3.Selected[i] then
 begin
for j:=ListBox6.Items.Count-1 downto 0 do
   begin

    if ListBox3.Items[i]=ListBox6.Items[j] then
    begin
    ListBox6.Items.Delete(j);
  ListBox3.Items.Delete(i);
   Label8.Caption:='已选择 '+inttostr(ListBox3.Items.count)+'  题.          ';
        Label9.Caption:='还剩余 '+inttostr(definepaperform.filltextnum-ListBox3.Items.count)+'  题.          ';

      break;
   end;
     end;
end;

end;



procedure Tchoosepaperform.BitBtn9Click(Sender: TObject);
var
j,i:integer;
begin
for i:=ListBox4.Items.Count-1 downto 0 do
 if ListBox4.Selected[i] then
 begin
      for j:=ListBox6.Items.Count-1 downto 0 do
   begin

    if ListBox4.Items[i]=ListBox6.Items[j] then
    begin
    ListBox6.Items.Delete(j);
  ListBox4.Items.Delete(i);
   Label11.Caption:='已选择 '+inttostr(ListBox4.Items.count)+'  题.          ';
        Label12.Caption:='还剩余 '+inttostr(definepaperform.readpronum-ListBox4.Items.count)+'  题.          ';

      break;
   end;

         end;

end;

end;



procedure Tchoosepaperform.BitBtn11Click(Sender: TObject);
var
j,i:integer;
begin
for i:=ListBox5.Items.Count-1 downto 0 do
 if ListBox5.Selected[i] then
 begin
   for j:=ListBox6.Items.Count-1 downto 0 do
   begin

    if ListBox5.Items[i]=ListBox6.Items[j] then
    begin
    ListBox6.Items.Delete(j);
  ListBox5.Items.Delete(i);
   Label14.Caption:='已选择 '+inttostr(ListBox5.Items.count)+'  题.          ';
        Label15.Caption:='还剩余 '+inttostr(definepaperform.procedurenum-ListBox5.Items.count)+'  题.          ';

      break;
   end;

         end;

end;

end;

procedure Tchoosepaperform.FormCreate(Sender: TObject);
begin

//choosefull:=false;
//judgefull:=false;
//filltextfull:=false;
//readprofull:=false;
//procedurefull:=false;
PageControl1.ActivePage:=TabSheet1;
GroupBox1.Visible:=true;
BitBtn1.Enabled:=true;
BitBtn2.Enabled:=true;
end;



procedure Tchoosepaperform.ListBox2Click(Sender: TObject);
begin
BitBtn4.Enabled:=true;
BitBtn5.Enabled:=true;
Memo2.Show;
end;

procedure Tchoosepaperform.ListBox1Click(Sender: TObject);
//var
//i:integer;
begin
 BitBtn1.Enabled:=true;
BitBtn2.Enabled:=true;
Memo1.Show;


//for i:=ListBox1.Items.Count-1 downto 0 do
 // begin
//if ListBox1.Selected[i] then

  // end;
end;

procedure Tchoosepaperform.ListBox3Click(Sender: TObject);
begin
BitBtn6.Enabled:=true;
BitBtn7.Enabled:=true;
Memo3.Show;
end;

procedure Tchoosepaperform.ListBox4Click(Sender: TObject);
begin
BitBtn8.Enabled:=true;
BitBtn9.Enabled:=true;
Memo4.Show;
end;

procedure Tchoosepaperform.ListBox5Click(Sender: TObject);
begin
BitBtn10.Enabled:=true;
BitBtn11.Enabled:=true;
Memo5.Show;
end;

procedure Tchoosepaperform.BitBtn12Click(Sender: TObject);
var
 p,i,j,k,n,m: integer;
begin
 p:=1;
if ListBox1.Items.Count<definepaperform.choosenum then
showmessage('选择题还未选择完毕!')
else
 if  ListBox2.Items.Count<definepaperform.judgenum then
  showmessage('判断题还未选择完毕!')
else
   if  ListBox3.Items.Count<definepaperform.filltextnum then
  showmessage('填空题还未选择完毕!')
 else
  if ListBox4.Items.Count<definepaperform.readpronum then
  showmessage('程序阅读题还未选择完毕!')
 else
   if  ListBox5.Items.Count<definepaperform.procedurenum then
  showmessage('编程题还未选择完毕!')
else if (ListBox1.Items.Count=definepaperform.choosenum)and (ListBox2.Items.Count=definepaperform.judgenum)and(ListBox3.Items.Count=definepaperform.filltextnum)and(ListBox4.Items.Count=definepaperform.readpronum)and(ListBox5.Items.Count=definepaperform.procedurenum) then
  begin

papermadeform.show;
papermadeform.Memo1.Text:='';

papermadeform.Memo1.Text:='             '+definepaperform.DBEdit1.Text+'                   '+'总分:'+definepaperform.DBEdit2.Text+#13#10#13#10#13#10;
papermadeform.Memo1.Text:=papermadeform.Memo1.Text+'学校__________班级__________姓名__________得分________'+#13#10#13#10;
madeanswerform.Memo1.Text:='';
madeanswerform.Memo1.Text:='             '+definepaperform.DBEdit1.Text+'答案'+#13#10#13#10;
if definepaperform.DBEdit3.Text<>'0' then
begin
try
i:=0;
    papermadeform.Memo1.Text:=papermadeform.Memo1.Text+''+#13#10+tmno[p]+'选择题'+'(共'+definepaperform.DBEdit3.Text+'小题,每题'+definepaperform.DBEdit6.Text+'分,小计'+definepaperform.DBEdit9.Text+'分).'+#13#10+'';
   madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+''+#13#10+tmno[p]+'选择题: '+#13#10+'';
    p:=p+1;
   while i<listbox1.Count do
begin
   query1.Close;
   query1.SQL.Clear;
   query1.SQL.Add('select tigan,xa,xb,xc,xd,answer from ti_choose where tno='''+listbox1.Items.Strings[i]+'''' );
   query1.ExecSQL;
   query1.Active:=true;
     i:=i+1;

  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+inttostr(i)+'、'+query1.fieldbyname('tigan').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('xa').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('xb').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('xc').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('xd').AsString+' '+#13#10;
 madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+inttostr(i)+'、'+query1.fieldbyname('answer').AsString+' '+#13#10+'';
//   watchdaform.memo1.Text:=watchdaform.memo1.Text+'改正为:'+query1.fieldbyname('gz').AsString+' '+#13#10+'';
 end;
   //进入选择题的生成
 //  Application.CreateForm(Tresultmadeform, resultmadeform);
 //  resultmadeform.Show;
 //   close;
except
end;
  end;
  if definepaperform.DBEdit4.Text<>'0' then
  begin
try
j:=0;
   papermadeform.Memo1.Text:=papermadeform.Memo1.Text+''+#13#10+tmno[p]+'判断题'+'(共'+definepaperform.DBEdit4.Text+'小题,每题'+definepaperform.DBEdit7.Text+'分,小计'+definepaperform.DBEdit10.Text+'分).'+#13#10+'';
   
  madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+''+#13#10+tmno[p]+'判断题: '+#13#10+'';
   p:=p+1;

  while j<listbox2.Count do
begin
   query1.Close;
   query1.SQL.Clear;
   query1.SQL.Add('select tigan,answer from ti_judge where tno='''+listbox2.Items.Strings[j]+'''' );
   query1.ExecSQL;
   query1.Active:=true;
     j:=j+1;

  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+inttostr(j)+'、'+query1.fieldbyname('tigan').AsString+' ';
 madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+inttostr(j)+'、'+query1.fieldbyname('answer').AsString+' '+#13#10+'';
//   watchdaform.memo1.Text:=watchdaform.memo1.Text+'改正为:'+query1.fieldbyname('gz').AsString+' '+#13#10+'';
 end;
   //进入选择题的生成
 //  Application.CreateForm(Tresultmadeform, resultmadeform);
 //  resultmadeform.Show;
 //   close;
except
end;

end;

if definepaperform.DBEdit12.Text<>'0' then
begin
try
k:=0;
   papermadeform.Memo1.Text:=papermadeform.Memo1.Text+''+#13#10#13#10+tmno[p]+'填空题'+'(共'+definepaperform.DBEdit12.Text+'小题,每题'+definepaperform.DBEdit13.Text+'分,小计'+definepaperform.DBEdit14.Text+'分).'+#13#10+'';

  madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+''+#13#10+tmno[p]+'填空题: '+#13#10+'';
      p:=p+1;
  while k<listbox3.Count do
begin
   query1.Close;
   query1.SQL.Clear;
   query1.SQL.Add('select tigan,ka,kb,kc,kd from ti_filltext where tno='''+listbox3.Items.Strings[k]+'''' );
   query1.ExecSQL;
   query1.Active:=true;
     k:=k+1;

  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+inttostr(k)+'、'+query1.fieldbyname('tigan').AsString+' '+#13#10;
 madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+#13#10+inttostr(k)+'、'+query1.fieldbyname('ka').AsString+' '+#13;
 if query1.fieldbyname('kb').AsString<>'' then
madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+#10+'   '+query1.fieldbyname('kb').AsString+' '+#13;
 if query1.fieldbyname('kc').AsString<>'' then
 madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+#10+'   '+query1.fieldbyname('kc').AsString+' '+#13;
 if query1.fieldbyname('kd').AsString<>'' then
 madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+#10+'   '+query1.fieldbyname('kd').AsString+' '+#13;
//   watchdaform.memo1.Text:=watchdaform.memo1.Text+'改正为:'+query1.fieldbyname('gz').AsString+' '+#13#10+'';
 end;
   //进入选择题的生成
 //  Application.CreateForm(Tresultmadeform, resultmadeform);
 //  resultmadeform.Show;
 //   close;
except
end;
end;

if definepaperform.DBEdit5.Text<>'0' then
begin
try
m:=0;
   papermadeform.Memo1.Text:=papermadeform.Memo1.Text+''+#13#10+tmno[p]+'程序阅读题'+'(共'+definepaperform.DBEdit5.Text+'小题,每题'+definepaperform.DBEdit8.Text+'分,小计'+definepaperform.DBEdit11.Text+'分).'+#13#10+'';

  madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+''+#13#10+tmno[p]+'程序阅读题:'+#13#10+'';
    p:=p+1;
  while m<listbox4.Count do
begin
   query1.Close;
   query1.SQL.Clear;
   query1.SQL.Add('select tigan,ctigan1,x1a,x1b,x1c,x1d,answer1,ctigan2,x2a,x2b,x2c,x2d,answer2,ctigan3,x3a,x3b,x3c,x3d,answer3 from ti_readpro where tno='''+listbox4.Items.Strings[m]+'''' );
   query1.ExecSQL;
   query1.Active:=true;
     m:=m+1;

  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+inttostr(m)+'、'+query1.fieldbyname('tigan').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('ctigan1').AsString+' '+#13#10#13#10;
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x1a').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x1b').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x1c').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x1d').AsString+' '+#13#10;
  if query1.FieldByName('ctigan2').AsString<>'' then
  begin
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('ctigan2').AsString+' '+#13#10#13#10;
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x2a').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x2b').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x2c').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x2d').AsString+' '+#13#10;
  end;
  if query1.FieldByName('ctigan3').AsString<>'' then
  begin
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('ctigan3').AsString+' '+#13#10#13#10;
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x3a').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x3b').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x3c').AsString+' ';
  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+query1.fieldbyname('x3d').AsString+' '+#13#10;
   end;
  madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+#13#10+inttostr(m)+'、'+query1.fieldbyname('answer1').AsString+' '+#13;
 if  query1.fieldbyname('answer2').AsString<>'' then
 madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+#10+'   '+query1.fieldbyname('answer2').AsString+' '+#13;
 if  query1.fieldbyname('answer3').AsString<>'' then
 madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+#10+'   '+query1.fieldbyname('answer3').AsString+' '+#13;
//   watchdaform.memo1.Text:=watchdaform.memo1.Text+'改正为:'+query1.fieldbyname('gz').AsString+' '+#13#10+'';
 end;
   //进入选择题的生成
 //  Application.CreateForm(Tresultmadeform, resultmadeform);
 //  resultmadeform.Show;
 //   close;
except
end;
end;
if definepaperform.DBEdit15.Text<>'0' then
begin
try
n:=0;
   papermadeform.Memo1.Text:=papermadeform.Memo1.Text+''+#13#10+tmno[p]+'编程题'+'(共'+definepaperform.DBEdit15.Text+'小题,每题'+definepaperform.DBEdit16.Text+'分,小计'+definepaperform.DBEdit17.Text+'分).'+#13#10+'';

  madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+''+#13#10+tmno[p]+'编程题:'+#13#10+'';
     p:=p+1;
  while n<listbox5.Count do
begin
   query1.Close;
   query1.SQL.Clear;
   query1.SQL.Add('select tigan,answer from ti_procedure where tno='''+listbox5.Items.Strings[n]+'''' );
   query1.ExecSQL;
   query1.Active:=true;
     n:=n+1;

  papermadeform.Memo1.Text:=papermadeform.Memo1.Text+#13#10+inttostr(n)+'、'+query1.fieldbyname('tigan').AsString+' '+#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10;
 madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+inttostr(n)+'、'+query1.fieldbyname('answer').AsString+' '+#13#10+'';
//   watchdaform.memo1.Text:=watchdaform.memo1.Text+'改正为:'+query1.fieldbyname('gz').AsString+' '+#13#10+'';
 end;
   //进入选择题的生成
 //  Application.CreateForm(Tresultmadeform, resultmadeform);
 //  resultmadeform.Show;
 //   close;
except
end;
  end;
 end;


 //  query1.Active:=true;



end;

end.

⌨️ 快捷键说明

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