Unit18.pas
上传用户:szyozho
上传日期:2013-04-13
资源大小:3688k
文件大小:48k
- unit Unit18;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls, StdCtrls, ComCtrls, Buttons, Menus, DB, DBTables;
- type
- Tpaperautoform = class(TForm)
- MainMenu1: TMainMenu;
- N5: TMenuItem;
- N19: TMenuItem;
- N6: TMenuItem;
- N21: TMenuItem;
- FontDialog1: TFontDialog;
- Memo1: TMemo;
- Label1: TLabel;
- Label2: TLabel;
- BitBtn1: TBitBtn;
- Label3: TLabel;
- ProgressBar1: TProgressBar;
- BitBtn2: TBitBtn;
- ComboBox2: TComboBox;
- Query1: TQuery;
- ListBox1: TListBox;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- ListBox2: TListBox;
- N1: TMenuItem;
- N3: TMenuItem;
- N7: TMenuItem;
- N8: TMenuItem;
- N4: TMenuItem;
- N9: TMenuItem;
- N10: TMenuItem;
- N11: TMenuItem;
- N12: TMenuItem;
- N13: TMenuItem;
- procedure definediff(a:integer);
- procedure N19Click(Sender: TObject);
- procedure U1Click(Sender: TObject);
- procedure N12Click(Sender: TObject);
- procedure N13Click(Sender: TObject);
- procedure N14Click(Sender: TObject);
- procedure N16Click(Sender: TObject);
- procedure N2Click(Sender: TObject);
- procedure BitBtn1Click(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure BitBtn1MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure ComboBox2Change(Sender: TObject);
- procedure SpeedButton1Click(Sender: TObject);
- procedure SpeedButton2Click(Sender: TObject);
- procedure N1Click(Sender: TObject);
- procedure N24Click(Sender: TObject);
- procedure N9Click(Sender: TObject);
- procedure N10Click(Sender: TObject);
- procedure N11Click(Sender: TObject);
- procedure N7Click(Sender: TObject);
- procedure N8Click(Sender: TObject);
- private
- { Private declarations }
- public
- // tmno: array[1..5] of string=('一、','二、','三、','四、','五、');
- thao: array[1..800] of integer;
- havetake: array[1..800] of integer;
- diff: array[1..5] of integer;
- { Public declarations }
- // tmno: array[1..5] of string=('一、','二、','三、','四、','五、');
- end;
- var
- paperautoform: Tpaperautoform;
- tmno: array[1..5] of string=('一、','二、','三、','四、','五、');
- TF:array[1..9] of string=('f','f','f','f','f','f','f','f','f');
- paperallnumber,choosenumber,judgenumber,filltextnumber,readpronumber,procedurenumber:integer;
- implementation
- uses printers, Unit10, Unit22, Unit3, Unit4;
- {$R *.dfm}
- procedure Tpaperautoform.definediff(a:integer);
- var
- g:integer;
- begin
- case a of
- 1:
- begin
- if (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='')
- or (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='0')
- then
- diff[1]:=1
- else
- diff[1]:=strtoint(copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1) );
- if (copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1)='')
- or (copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1)='0')
- then
- diff[2]:=1
- else
- diff[2]:=strtoint(copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1));
- if (copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1)='')
- or (copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1)='0')
- then
- diff[3]:=1
- else
- diff[3]:=strtoint(copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1));
- if (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='')
- or (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='0')
- then
- diff[4]:=1
- else
- diff[4]:=strtoint(copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1));
- diff[5]:=0;
- end;
- 2:
- begin
- if (copy(floattostr(paperallnumber*0.05),1,pos('.',floattostr(paperallnumber*0.05))-1)='')
- or (copy(floattostr(paperallnumber*0.05),1,pos('.',floattostr(paperallnumber*0.05))-1)='0')
- then
- diff[1]:=1
- else
- diff[1]:=strtoint(copy(floattostr(paperallnumber*0.05),1,pos('.',floattostr(paperallnumber*0.05))-1) );
- if (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='')
- or (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='0')
- then
- diff[2]:=1
- else
- diff[2]:=strtoint(copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1));
- if (copy(floattostr(paperallnumber*0.7),1,pos('.',floattostr(paperallnumber*0.7))-1)='')
- or (copy(floattostr(paperallnumber*0.7),1,pos('.',floattostr(paperallnumber*0.7))-1)='0')
- then
- diff[3]:=1
- else
- diff[3]:=strtoint(copy(floattostr(paperallnumber*0.7),1,pos('.',floattostr(paperallnumber*0.7))-1));
- if (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='')
- or (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='0')
- then
- diff[4]:=1
- else
- diff[4]:=strtoint(copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1));
- if (copy(floattostr(paperallnumber*0.05),1,pos('.',floattostr(paperallnumber*0.05))-1)='')
- or (copy(floattostr(paperallnumber*0.05),1,pos('.',floattostr(paperallnumber*0.05))-1)='0')
- then
- diff[5]:=1
- else
- diff[5]:=strtoint(copy(floattostr(paperallnumber*0.05),1,pos('.',floattostr(paperallnumber*0.05))-1));
- diff[5]:=0;
- end;
- 3:
- begin
- diff[1]:=0;
- if (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='')
- or (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='0')
- then
- diff[2]:=1
- else
- diff[2]:=strtoint(copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1));
- if (copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1)='')
- or (copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1)='0')
- then
- diff[3]:=1
- else
- diff[3]:=strtoint(copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1));
- if (copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1)='')
- or (copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1)='0')
- then
- diff[4]:=1
- else
- diff[4]:=strtoint(copy(floattostr(paperallnumber*0.4),1,pos('.',floattostr(paperallnumber*0.4))-1));
- if (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='')
- or (copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1)='0')
- then
- diff[5]:=1
- else
- diff[5]:=strtoint(copy(floattostr(paperallnumber*0.1),1,pos('.',floattostr(paperallnumber*0.1))-1));
- end;
- end;
- end;
- procedure Tpaperautoform.N19Click(Sender: TObject);
- begin
- if fontdialog1.Execute then
- begin
- memo1.Font:=fontdialog1.Font;
- end;
- end;
- procedure Tpaperautoform.U1Click(Sender: TObject);
- begin
- memo1.Undo;
- end;
- procedure Tpaperautoform.N12Click(Sender: TObject);
- begin
- Memo1.PasteFromClipboard;
- end;
- procedure Tpaperautoform.N13Click(Sender: TObject);
- begin
- memo1.SelectAll;
- paperautoform.N11.Enabled:=true;
- paperautoform.N12.Enabled:=true;
- end;
- procedure Tpaperautoform.N14Click(Sender: TObject);
- begin
- memo1.PasteFromClipboard;
- end;
- procedure Tpaperautoform.N16Click(Sender: TObject);
- begin
- memo1.SelectAll;
- //paperautoform.N14.Enabled:=true;
- //paperautoform.N13.Enabled:=true;
- end;
- procedure Tpaperautoform.N2Click(Sender: TObject);
- //var lines :integer;
- // prntext:system.text;
- begin
- Screen.Cursor:=crHourGlass;
- try
- print;
- ShowMessage('打印完毕');
- finally
- Screen.Cursor:=crDefault;
- end;
- {
- if printdialog1.Execute then
- assignprn(prntext);
- rewrite(prntext);
- printer.canvas.Font:=memo1.font;
- for lines:=0 to memo1.Lines.Count-1 do
- begin
- writeln(prntext,memo1.lines[lines]);
- system.Close(prntext);
- end; }
- end;
- procedure Tpaperautoform.BitBtn1Click(Sender: TObject);
- var
- tt,pp,cc,mm,ii,n,diffnum,temp,m,r,ran,q,i,j:integer;
- t,hade:boolean;
- c,f,ju,re,p:integer;
- begin
- pp:=1;
- //ListBox2.Enabled:=false;
- if ComboBox2.Text='' then
- begin
- showmessage('请选择试卷难度!');
- exit;
- end;
-
- //Label3.Caption:='';
- //Label3.Caption:='试卷正在提取中,请耐心等待... ';
- //Label3.Show;
- c:=choosenumber;
- f:=filltextnumber;
- ju:=judgenumber;
- re:=readpronumber;
- p:=procedurenumber;
- progressbar1.Position:=0;
- progressbar1.Max:=paperallnumber+10;
- progressbar1.Position:=10;
- randomize;
- temp:=0;
- i:=1;
- t:=false;
- definediff(ComboBox2.ItemIndex+1);
- // showmessage(inttostr(choosenumber));
- for ii:=ListBox2.Items.Count-1 downto 0 do
- begin
- if ListBox2.Items[ii]='第一章 C语言基础知识' then TF[1]:='t';
- if ListBox2.Items[ii]='第二章 数据类型、运算符与表达式' then TF[2]:='t';
- if ListBox2.Items[ii]='第三章 顺序结构' then TF[3]:='t';
- if ListBox2.Items[ii]='第四章 选择结构' then TF[4]:='t';
- if ListBox2.Items[ii]='第五章 循环控制' then TF[5]:='t';
- if ListBox2.Items[ii]='第六章 数组指针' then TF[6]:='t';
- if ListBox2.Items[ii]='第七章 函数 结构体与共用体' then TF[7]:='t';
- if ListBox2.Items[ii]='第八章 预处理命令' then TF[8]:='t';
- if ListBox2.Items[ii]='第九章 常用算法设计' then TF[9]:='t';
- end;
- //选择题
- //TF存放的是要考的与不考的章,标号就是代表第几章
- paperautoform.Memo1.Text:='';
- paperautoform.Memo1.Text:=' '+definepaperform.DBEdit1.Text+' '+'总分:'+definepaperform.DBEdit2.Text+#13#10#13#10#13#10;
- paperautoform.Memo1.Text:=paperautoform.Memo1.Text+'学校__________班级__________姓名__________得分________'+#13#10#13#10;
- autoanswerform.Memo1.Text:='';
- autoanswerform.Memo1.Text:=' '+definepaperform.DBEdit1.Text+'答案'+#13#10#13#10;
- if definepaperform.DBEdit3.Text<>'0' then
- begin
- tt:=0;
- paperautoform.Memo1.Text:=paperautoform.Memo1.Text+''+#13#10+tmno[pp]+'选择题'+'(共'+definepaperform.DBEdit3.Text+'小题,每题'+definepaperform.DBEdit6.Text+'分,小计'+definepaperform.DBEdit9.Text+'分).'+#13#10+'';
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+''+#13#10+tmno[pp]+'选择题: '+#13#10+'';
- pp:=pp+1;
- end;
- // showmessage('cb');
- //----------------------------------------------------------------
- //------------------------------------------------------------
- while choosenumber<>0 do
- begin
- // if ListBox2.Items.Text='' then
- //
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tno from ti_choose') ;
- if ListBox2.Count>=1 then
- begin
- // if ListBox2.Count=1 then
- for mm:=1 to 9 do
- begin
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' where tno not like '''+inttostr(mm)+'%''');
- break;
- end;
- end;
- if listBox2.Count>1 then
- begin
- for mm:=1 to 9 do
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' and tno not like '''+inttostr(mm)+'%''');
- // showmessage(query1.SQL.Text);
- end;
- end;
- end;
- query1.Open;
- query1.First;
- {
- if ComboBox1.ItemIndex=-1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=0 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose where tno not like ''1%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose where tno not like ''2%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=2 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose where tno not like ''3%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=3 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose where tno not like ''4%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=4 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose where tno not like ''5%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=5 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose where tno not like ''6%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=6 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose where tno not like ''7%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=7 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose where tno not like ''8%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=8 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_choose where tno not like ''9%%%''');
- query1.Open;
- query1.First;
- end;
- }
- while not query1.Eof do
- begin
- hade:=false;
- if i=1 then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- end
- else
- if i>1 then
- begin
- for j:=i-1 downto 1 do
- begin
- if thao[j]=((Query1.FieldValues['tno']) div 10) then
- begin
- t:=true ;
- break;
- end
- else
- t:=false;
- end;
- if not t then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- t:=false;
- end;
- end;
- query1.Next;
- if not t then
- i:=i+1;
- end;
- temp:=random(i-1)+1;
- r:=thao[temp];
- q:=random(9)+1;
- ran:=r*10+q;
- // if m=1 then
- // havetake[1]:=0000;
- // else if
- for m:=1 to 800 do havetake[m]:=0;
- for m:=1 to 800 do
- begin
- if havetake[m]=ran then
- begin
- showmessage('chongfu');
- hade:=true;
- break;
- end;
- end;
- if not hade then
- begin
- for m:=0 to 800 do
- if havetake[m]=0 then
- begin
- havetake[m]:=ran;
- break;
- end;
- // showmessage(inttostr(ran));
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tigan,xa,xb,xc,xd,answer,difficulty from ti_choose where tno=:no');
- query1.ParamByName('no').Value:=ran;
- query1.Open;
- if choosenumber<>0 then
- begin
-
- if query1.RecordCount<>0 then //continue //showmessage('ddd')
- // else
- begin
- n:= strtoint(query1.FieldByName('difficulty').AsString);
- if diff[n] <>0 then
- // if definediff[strtoint(query1.fieldbyname('difficulty').AsString)]<>0 then
- begin
- // memo1.Text:=memo1.Text+'选择题';
- tt:=tt+1;
- // showmessage(inttostr(ran));
- memo1.Text:=memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('tigan').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('xa').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('xb').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('xc').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('xd').AsString+#13#10;
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('answer').AsString+#13#10;
- choosenumber:=choosenumber-1;
- n:=n-1;
- // strtoint(query1.fieldbyname('difficulty').AsString):=strtoint(query1.fieldbyname('difficulty').AsString)-1;
- end;
- end;
- end;
- //i:=thao[]
- end;
- // showmessage('choosestop');
- end;
- progressbar1.Position:=progressbar1.Position+c;
- //判断题
- // showmessage('ce');
- //-----------------------------------------------------------
- //--------------------------------------------------------------
- if definepaperform.DBEdit4.Text<>'0' then
- begin
- tt:=0;
- paperautoform.Memo1.Text:=paperautoform.Memo1.Text+''+#13#10+tmno[pp]+'判断题'+'(共'+definepaperform.DBEdit4.Text+'小题,每题'+definepaperform.DBEdit7.Text+'分,小计'+definepaperform.DBEdit10.Text+'分).'+#13#10+'';
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+''+#13#10+tmno[pp]+'判断题: '+#13#10+'';
- pp:=pp+1;
- end;
- while judgenumber<>0 do
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tno from ti_judge') ;
- if ListBox2.Count>=1 then
- begin
- // if ListBox2.Count=1 then
- for mm:=1 to 9 do
- begin
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' where tno not like '''+inttostr(mm)+'%''');
- break;
- end;
- end;
- if listBox2.Count>1 then
- begin
- for mm:=1 to 9 do
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' and tno not like '''+inttostr(mm)+'%''');
- // showmessage(query1.SQL.Text);
- end;
- end;
- end;
- query1.Open;
- query1.First;
- {
- // showmessage('judgebegin');
- if ComboBox1.ItemIndex=-1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=0 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge where tno not like ''1%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge where tno not like ''2%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=2 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge where tno not like ''3%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=3 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge where tno not like ''4%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=4 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge where tno not like ''5%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=5 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge where tno not like ''6%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=6 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge where tno not like ''7%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=7 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge where tno not like ''8%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=8 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_judge where tno not like ''9%%%''');
- query1.Open;
- query1.First;
- end;
- }
- while not query1.Eof do
- begin
- hade:=false;
- if i=1 then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- end
- else
- if i>1 then
- begin
- for j:=i-1 downto 1 do
- begin
- if thao[j]=((Query1.FieldValues['tno']) div 10) then
- begin
- t:=true ;
- break;
- end
- else
- t:=false;
- end;
- if not t then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- t:=false;
- end;
- end;
- query1.Next;
- if not t then
- i:=i+1;
- end;
- temp:=random(i-1)+1;
- r:=thao[temp];
- q:=random(9)+1;
- ran:=r*10+q;
- // if m=1 then
- // havetake[1]:=0000;
- // else if
- for m:=1 to 800 do havetake[m]:=0;
- for m:=1 to 800 do
- begin
- if (havetake[m] div 10)=r then
- begin
- showmessage('chongfu');
- hade:=true;
- break;
- end;
- end;
- if not hade then
- begin
- for m:=0 to 800 do
- if havetake[m]=0 then
- begin
- havetake[m]:=ran;
- break;
- end;
- // showmessage(inttostr(ran));
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tigan,answer,difficulty from ti_judge where tno=:no');
- query1.ParamByName('no').Value:=ran;
- query1.Open;
- if judgenumber<>0 then
- begin
-
- if query1.RecordCount<>0 then //continue//showmessage('ddd')
- // else
- begin
- n:= strtoint(query1.FieldByName('difficulty').AsString);
- if diff[n] <>0 then
- // if definediff[strtoint(query1.fieldbyname('difficulty').AsString)]<>0 then
- begin
- // memo1.Text:=memo1.Text+'判断题';
- tt:=tt+1;
- // showmessage(inttostr(ran));
- memo1.Text:=memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('tigan').AsString+#13#10;
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('answer').AsString+#13#10;
- judgenumber:=judgenumber-1;
- n:=n-1;
- // strtoint(query1.fieldbyname('difficulty').AsString):=strtoint(query1.fieldbyname('difficulty').AsString)-1;
- end;
- end;
- end;
- //i:=thao[]
- end;
- // showmessage('judgestop');
- end;
- progressbar1.Position:=progressbar1.Position+ju;
-
- if definepaperform.DBEdit12.Text<>'0' then
- begin
- tt:=0;
- paperautoform.Memo1.Text:=paperautoform.Memo1.Text+''+#13#10#13#10+tmno[pp]+'填空题'+'(共'+definepaperform.DBEdit12.Text+'小题,每题'+definepaperform.DBEdit13.Text+'分,小计'+definepaperform.DBEdit14.Text+'分).'+#13#10+'';
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+''+#13#10+tmno[pp]+'填空题: '+#13#10+'';
- pp:=pp+1;
- end;
- //填空题
- //----------------------------------------------------------------
- //----------------------------------------------------------------------
- while filltextnumber<>0 do
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tno from ti_filltext') ;
- if ListBox2.Count>=1 then
- begin
- // if ListBox2.Count=1 then
- for mm:=1 to 9 do
- begin
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' where tno not like '''+inttostr(mm)+'%''');
- break;
- end;
- end;
- if listBox2.Count>1 then
- begin
- for mm:=1 to 9 do
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' and tno not like '''+inttostr(mm)+'%''');
- // showmessage(query1.SQL.Text);
- end;
- end;
- end;
- query1.Open;
- query1.First;
- {
- // showmessage('filltextbegin');
- if ComboBox1.ItemIndex=-1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=0 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext where tno not like ''1%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext where tno not like ''2%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=2 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext where tno not like ''3%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=3 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext where tno not like ''4%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=4 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext where tno not like ''5%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=5 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext where tno not like ''6%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=6 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext where tno not like ''7%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=7 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext where tno not like ''8%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=8 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_filltext where tno not like ''9%%%''');
- query1.Open;
- query1.First;
- end;
- }
- while not query1.Eof do
- begin
- hade:=false;
- if i=1 then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- end
- else
- if i>1 then
- begin
- for j:=i-1 downto 1 do
- begin
- if thao[j]=((Query1.FieldValues['tno']) div 10) then
- begin
- t:=true ;
- break;
- end
- else
- t:=false;
- end;
- if not t then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- t:=false;
- end;
- end;
- query1.Next;
- if not t then
- i:=i+1;
- end;
- temp:=random(i-1)+1;
- r:=thao[temp];
-
- q:=random(9)+1;
- ran:=r*10+q;
- // if m=1 then
- // havetake[1]:=0000;
- // else if
- for m:=1 to 800 do havetake[m]:=0;
- for m:=1 to 800 do
- begin
- if havetake[m]=ran then
- begin
- showmessage('chongfu');
- hade:=true;
- break;
- end;
- end;
- if not hade then
- begin
- for m:=0 to 800 do
- if havetake[m]=0 then
- begin
- havetake[m]:=ran;
- break;
- end;
- // showmessage(inttostr(ran));
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tigan,ka,kb,kc,kd,difficulty from ti_filltext where tno=:no');
- query1.ParamByName('no').Value:=ran;
- query1.Open;
- if filltextnumber<>0 then
- begin
-
- if query1.RecordCount<>0 then //continue//showmessage('ddd')
- // else
- begin
- n:= strtoint(query1.FieldByName('difficulty').AsString);
- if diff[n] <>0 then
- // if definediff[strtoint(query1.fieldbyname('difficulty').AsString)]<>0 then
- begin
- tt:=tt+1;
- // memo1.Text:=memo1.Text+'填空题';
- // showmessage(inttostr(ran));
- memo1.Text:=memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('tigan').AsString+#13#10;
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('ka').AsString+#13#10;
- if query1.fieldbyname('kb').AsString<>'' then
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+query1.fieldbyname('kb').AsString+#13#10;
- //form.Memo1.Text:=madeanswerform.Memo1.Text+#10+' '+query1.fieldbyname('kb').AsString+' '+#13;
- if query1.fieldbyname('kc').AsString<>'' then
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+query1.fieldbyname('kc').AsString+#13#10;
- //madeanswerform.Memo1.Text:=answerform.Memo1.Text+#10+' '+query1.fieldbyname('kc').AsString+' '+#13;
- if query1.fieldbyname('kd').AsString<>'' then
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+query1.fieldbyname('kd').AsString+#13#10;
- //madeanswerform.Memo1.Text:=madeanswerform.Memo1.Text+#10+' '+query1.fieldbyname('kd').AsString+' '+#13;
- filltextnumber:=filltextnumber-1;
- n:=n-1;
- // strtoint(query1.fieldbyname('difficulty').AsString):=strtoint(query1.fieldbyname('difficulty').AsString)-1;
- end;
- end;
- end;
- //i:=thao[]
- end;
- // showmessage('filltextstop');
- end;
- progressbar1.Position:=progressbar1.Position+f;
- if definepaperform.DBEdit5.Text<>'0' then
- begin
- tt:=0;
- paperautoform.Memo1.Text:=paperautoform.Memo1.Text+''+#13#10+tmno[pp]+'程序阅读题'+'(共'+definepaperform.DBEdit5.Text+'小题,每题'+definepaperform.DBEdit8.Text+'分,小计'+definepaperform.DBEdit11.Text+'分).'+#13#10+'';
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+''+#13#10+tmno[pp]+'程序阅读题:'+#13#10+'';
- pp:=pp+1;
- end;
- //程序阅读
- //------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- while readpronumber<>0 do
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tno from ti_readpro') ;
- if ListBox2.Count>=1 then
- begin
- // if ListBox2.Count=1 then
- for mm:=1 to 9 do
- begin
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' where tno not like '''+inttostr(mm)+'%''');
- break;
- end;
- end;
- if listBox2.Count>1 then
- begin
- for mm:=1 to 9 do
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' and tno not like '''+inttostr(mm)+'%''');
- // showmessage(query1.SQL.Text);
- end;
- end;
- end;
- query1.Open;
- query1.First;
- {
- // showmessage('readprobegib');
- if ComboBox1.ItemIndex=-1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=0 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro where tno not like ''1%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro where tno not like ''2%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=2 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro where tno not like ''3%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=3 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro where tno not like ''4%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=4 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro where tno not like ''5%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=5 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro where tno not like ''6%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=6 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro where tno not like ''7%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=7 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro where tno not like ''8%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=8 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_readpro where tno not like ''9%%%''');
- query1.Open;
- query1.First;
- end;
- }
- while not query1.Eof do
- begin
- hade:=false;
- if i=1 then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- end
- else
- if i>1 then
- begin
- for j:=i-1 downto 1 do
- begin
- if thao[j]=((Query1.FieldValues['tno']) div 10) then
- begin
- t:=true ;
- break;
- end
- else
- t:=false;
- end;
- if not t then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- t:=false;
- end;
- end;
- query1.Next;
- if not t then
- i:=i+1;
- end;
- temp:=random(i-1)+1;
- r:=thao[temp];
-
- q:=random(9)+1;
- ran:=r*10+q;
- // if m=1 then
- // havetake[1]:=0000;
- // else if
- for m:=1 to 800 do havetake[m]:=0;
- for m:=1 to 800 do
- begin
- if havetake[m]=ran then
- begin
- showmessage('chongfu');
- hade:=true;
- break;
- end;
- end;
- if not hade then
- begin
- for m:=0 to 800 do
- if havetake[m]=0 then
- begin
- havetake[m]:=ran;
- break;
- end;
- // showmessage(inttostr(ran));
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tigan,ctigan1,x1a,x1b,x1c,x1d,ctigan2,x2a,x2b,x2c,x2d,ctigan3,x3a,x3b,x3c,x3d,answer1,answer2,answer3,difficulty from ti_readpro where tno=:no');
- query1.ParamByName('no').Value:=ran;
- query1.Open;
- if readpronumber<>0 then
- begin
-
- if query1.RecordCount<>0 then// continue//showmessage('ddd')
- // else
- begin
- n:= strtoint(query1.FieldByName('difficulty').AsString);
- if diff[n] <>0 then
- // if definediff[strtoint(query1.fieldbyname('difficulty').AsString)]<>0 then
- begin
- tt:=tt+1;
- // memo1.Text:=memo1.Text+'程序阅读题';
- // showmessage(inttostr(ran));
- memo1.Text:=memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('tigan').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('ctigan1').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x1a').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x1b').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x1c').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x1d').AsString+#13#10;
- if query1.FieldByName('ctigan2').AsString<>'' then
- begin
- memo1.Text:=memo1.Text+query1.fieldbyname('ctigan2').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x2a').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x2b').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x2c').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x2d').AsString+#13#10;
- end;
- if query1.FieldByName('ctigan3').AsString<>'' then
- begin
- memo1.Text:=memo1.Text+query1.fieldbyname('ctigan3').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x3a').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x3b').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x3c').AsString+#13#10;
- memo1.Text:=memo1.Text+query1.fieldbyname('x3d').AsString+#13#10;
- end;
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+query1.Fieldbyname('answer1').AsString+#13#10;
- if query1.FieldByName('answer2').AsString<>'' then
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+query1.Fieldbyname('answer2').AsString+#13#10;
- if query1.FieldByName('answer3').AsString<>'' then
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+inttostr(tt)+'、'+query1.Fieldbyname('answer3').AsString+#13#10;
- readpronumber:=readpronumber-1;
- n:=n-1;
- // strtoint(query1.fieldbyname('difficulty').AsString):=strtoint(query1.fieldbyname('difficulty').AsString)-1;
- end;
- end;
- end;
- //i:=thao[]
- end;
- // showmessage('readprostop');
- end;
- // showmessage(inttostr(procedurenumber));
- progressbar1.Position:=progressbar1.Position+re;
- if definepaperform.DBEdit15.Text<>'0' then
- begin
- tt:=0;
- paperautoform.Memo1.Text:=paperautoform.Memo1.Text+''+#13#10+tmno[pp]+'编程题'+'(共'+definepaperform.DBEdit15.Text+'小题,每题'+definepaperform.DBEdit16.Text+'分,小计'+definepaperform.DBEdit17.Text+'分).'+#13#10+'';
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+''+#13#10+tmno[pp]+'编程题:'+#13#10+'';
- pp:=pp+1;
- end;
- //编程题
- //------------------------------------------------------------------------
- //-----------------------------------------------------------------------
- while procedurenumber<>0 do
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tno from ti_procedure') ;
- if ListBox2.Count>=1 then
- begin
- // if ListBox2.Count=1 then
- for mm:=1 to 9 do
- begin
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' where tno not like '''+inttostr(mm)+'%''');
- break;
- end;
- end;
- if listBox2.Count>1 then
- begin
- for mm:=1 to 9 do
- if TF[mm]='t' then
- begin
- query1.SQL.Add(' and tno not like '''+inttostr(mm)+'%''');
- // showmessage(query1.SQL.Text);
- end;
- end;
- end;
- query1.Open;
- query1.First;
- {
- // showmessage('procedurebdgin');
- if ComboBox1.ItemIndex=-1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=0 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure where tno not like ''1%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=1 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure where tno not like ''2%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=2 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure where tno not like ''3%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=3 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure where tno not like ''4%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=4 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure where tno not like ''5%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=5 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure where tno not like ''6%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=6 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure where tno not like ''7%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=7 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure where tno not like ''8%%%''');
- query1.Open;
- query1.First;
- end;
- if ComboBox1.ItemIndex=8 then
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.add('select tno from ti_procedure where tno not like ''9%%%''');
- query1.Open;
- query1.First;
- end;
- }
- while not query1.Eof do
- begin
- hade:=false;
- if i=1 then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- end
- else
- if i>1 then
- begin
- for j:=i-1 downto 1 do
- begin
- if thao[j]=((Query1.FieldValues['tno']) div 10) then
- begin
- t:=true ;
- break;
- end
- else
- t:=false;
- end;
- if not t then
- begin
- thao[i]:=((Query1.FieldValues['tno']) div 10);
- // memo1.Text:=memo1.Text+inttostr(thao[i])+' ';
- t:=false;
- end;
- end;
- query1.Next;
- if not t then
- i:=i+1;
- end;
- temp:=random(i-1)+1;
- r:=thao[temp];
-
- q:=random(9)+1;
- ran:=r*10+q;
- // if m=1 then
- // havetake[1]:=0000;
- // else if
- for m:=1 to 800 do havetake[m]:=0;
- for m:=1 to 800 do
- begin
- if havetake[m]=ran then
- begin
- showmessage('chongfu');
- hade:=true;
- break;
- end;
- end;
- if not hade then
- begin
- for m:=0 to 800 do
- if havetake[m]=0 then
- begin
- havetake[m]:=ran;
- break;
- end;
- // showmessage(inttostr(ran));
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.Add('select tigan,answer,difficulty from ti_procedure where tno=:no');
- query1.ParamByName('no').Value:=ran;
- query1.Open;
- if procedurenumber<>0 then
- begin
-
- if query1.RecordCount<>0 then// continue//showmessage('ddd')
- // else
- begin
- n:= strtoint(query1.FieldByName('difficulty').AsString);
- if diff[n] <>0 then
- // if definediff[strtoint(query1.fieldbyname('difficulty').AsString)]<>0 then
- begin
- tt:=tt+1;
- // memo1.Text:=memo1.Text+'编程题';
- // showmessage(inttostr(ran));
- memo1.Text:=memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('tigan').AsString+#13#10;
- autoanswerform.Memo1.Text:=autoanswerform.Memo1.Text+inttostr(tt)+'、'+query1.fieldbyname('answer').AsString+#13#10;
- procedurenumber:=procedurenumber-1;
- n:=n-1;
- // strtoint(query1.fieldbyname('difficulty').AsString):=strtoint(query1.fieldbyname('difficulty').AsString)-1;
- end;
- end;
- end;
- //i:=thao[]
- end;
- end;
- // showmessage('pocedurestop');
- progressbar1.Position:=progressbar1.Position+p;
- Label3.Hide;
- showmessage('试卷提取完毕!');
- for cc:=1 to 9 do
- TF[cc]:='f';
-
- end;
- procedure Tpaperautoform.FormShow(Sender: TObject);
- begin
- choosenumber:=strtoint(definepaperform.DBEdit3.Text);
- judgenumber:=strtoint(definepaperform.DBEdit4.Text);
- filltextnumber:=strtoint(definepaperform.DBEdit12.Text);
- readpronumber:=strtoint(definepaperform.DBEdit5.Text);
- procedurenumber:=strtoint(definepaperform.DBEdit15.Text);
- //showmessage(inttostr(choosenumber)+' '+inttostr(judgenumber)+' '+inttostr(filltextnumber)+' '+inttostr(readpronumber)+' '+inttostr(procedurenumber));
- paperallnumber:=choosenumber+judgenumber+filltextnumber+readpronumber+procedurenumber;
- end;
- procedure Tpaperautoform.FormCreate(Sender: TObject);
- begin
- label3.Hide;
- end;
- procedure Tpaperautoform.BitBtn1MouseDown(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- if ComboBox2.Text<>'' then
- label3.Show;
- end;
- procedure Tpaperautoform.ComboBox2Change(Sender: TObject);
- var
- i,j:integer;
- begin
- choosenumber:=strtoint(definepaperform.DBEdit3.Text);
- judgenumber:=strtoint(definepaperform.DBEdit4.Text);
- filltextnumber:=strtoint(definepaperform.DBEdit12.Text);
- readpronumber:=strtoint(definepaperform.DBEdit5.Text);
- procedurenumber:=strtoint(definepaperform.DBEdit15.Text);
- //showmessage(inttostr(choosenumber)+' '+inttostr(judgenumber)+' '+inttostr(filltextnumber)+' '+inttostr(readpronumber)+' '+inttostr(procedurenumber));
- paperallnumber:=choosenumber+judgenumber+filltextnumber+readpronumber+procedurenumber;
-
- paperautoform.ProgressBar1.Position:=0;
- memo1.Text:='';
- exit;
- for i:=0 to 800 do
- begin
- paperautoform.thao[i]:=0;
- paperautoform.havetake[i]:=0;
- end;
- for j:=1 to 5 do
- paperautoform.diff[j]:=0;
- query1.Close;
- query1.Open;
- end;
- procedure Tpaperautoform.SpeedButton1Click(Sender: TObject);
- var
- i:integer;
- begin
- for i:=0 to ListBox1.Items.Count-1 do
- if ListBox1.Selected[i] then
- begin
- ListBox2.Items.Append(ListBox1.Items[i]);
- ListBox1.Items.Delete(i);
- break;
- end;
- end;
- procedure Tpaperautoform.SpeedButton2Click(Sender: TObject);
- var
- i:integer;
- begin
- for i:=ListBox2.Items.Count-1 downto 0 do
- if ListBox2.Selected[i] then
- begin
- ListBox1.Items.Append(ListBox2.Items[i]);
- ListBox2.Items.Delete(i);
-
- break;
- end;
- //end;
- end;
- procedure Tpaperautoform.N1Click(Sender: TObject);
- begin
- autoanswerform.Show;
- end;
- procedure Tpaperautoform.N24Click(Sender: TObject);
- begin
- //mainform.papertime:=mainform.papertime+1;
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.text:='insert into papermanager values(:gg,''自动'',:ss,:dd)' ;
- // query1.ParamByName('nn').AsInteger:=mainform.papertime;
- query1.ParamByName('gg').AsString:=definepaperform.DBEdit1.Text;
- query1.ParamByName('ss').AsString:=paperautoform.Memo1.Text ;
- query1.ParamByName('dd').AsString:=autoanswerform.Memo1.Text ;
- // query1.ParamByName('hh').AsInteger:=strtoint(definepaperform.DBEdit18.Text) ;
- query1.ExecSQL;
- DataModule4.Table_papermanager.Active:=false;
- DataModule4.Table_papermanager.Active:=true;
- end;
- procedure Tpaperautoform.N9Click(Sender: TObject);
- begin
- memo1.Undo;
- end;
- procedure Tpaperautoform.N10Click(Sender: TObject);
- begin
- memo1.CutToClipboard;
- end;
- procedure Tpaperautoform.N11Click(Sender: TObject);
- begin
- memo1.CopyToClipboard;
- end;
- procedure Tpaperautoform.N7Click(Sender: TObject);
- begin
- query1.Close;
- query1.SQL.Clear;
- query1.SQL.text:='insert into papermanager values(:gg,''自动'',:ss,:dd)' ;
- query1.ParamByName('gg').AsString:=definepaperform.DBEdit1.Text;
- query1.ParamByName('ss').AsString:=paperautoform.Memo1.Text ;
- query1.ParamByName('dd').AsString:=autoanswerform.Memo1.Text ;
- // query1.ParamByName('hh').AsInteger:=strtoint(definepaperform.DBEdit18.Text) ;
- query1.ExecSQL;
- // mainform.papertime:=mainform.papertime+1;
- //savedialog1.Title:='保存生成后的试卷';
- //savedialog1.FileName:=fname;
- //if savedialog1.Execute then
- // begin
- // filename:=savedialog1.FileName;
- // memo1.Lines.SaveToFile(filename+'.doc');
- // end;
- DataModule4.Table_papermanager.Active:=false;
- DataModule4.Table_papermanager.Active:=true;
- end;
- procedure Tpaperautoform.N8Click(Sender: TObject);
- begin
- close;
- end;
- end.