?? unit8.~pas
字號:
unit Unit8;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, DB, DBTables, Buttons, Mask, ExtCtrls;
type
TForm8 = class(TForm)
tiankong: TPanel;
Label10: TLabel;
tino1: TLabel;
lk1: TLabel;
lk2: TLabel;
lk3: TLabel;
lk4: TLabel;
Label15: TLabel;
Label16: TLabel;
Label11: TLabel;
shumu1: TLabel;
Label13: TLabel;
k1: TDBEdit;
k2: TDBEdit;
k3: TDBEdit;
k4: TDBEdit;
BitBtn1: TBitBtn;
xz: TBitBtn;
BitBtn3: TBitBtn;
kongshu: TDBEdit;
DBMemo1: TDBMemo;
xuanze: TPanel;
Label9: TLabel;
tino: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label2: TLabel;
Label3: TLabel;
shumu: TLabel;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit9: TDBEdit;
DBEdit10: TDBEdit;
BitBtn4: TBitBtn;
tk: TBitBtn;
nextti: TBitBtn;
DBEdit1: TDBEdit;
xuanti: TQuery;
DataSource1: TDataSource;
isxuan: TDBCheckBox;
istian: TDBCheckBox;
BitBtn2: TBitBtn;
BitBtn5: TBitBtn;
tian: TDataSource;
xuantitian: TQuery;
xzf: TComboBox;
Label1: TLabel;
Label4: TLabel;
tzf: TComboBox;
inssjk: TQuery;
Query1: TQuery;
Button1: TButton;
procedure BitBtn4Click(Sender: TObject);
procedure nexttiClick(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure tkClick(Sender: TObject);
procedure xzClick(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure xuanzeClick(Sender: TObject);
procedure tiankongClick(Sender: TObject);
procedure xzfChange(Sender: TObject);
procedure tzfChange(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form8: TForm8;
implementation
uses unit6,unit5, Unit3, Unit7, Unit4;
{$R *.dfm}
procedure kongshu6(); //根據(jù)填空數(shù)目來設(shè)定4個填空框的隱現(xiàn)
begin
case strtoint(form6.kongshu.Text) of
1:begin form6.lk2.Visible :=false;form6.k2.Visible :=false;
form6.lk3.Visible :=false;form6.k3.Visible :=false;
form6.lk4.Visible:=false;form6.k4.Visible :=false;end;
2:begin form6.lk3.Visible :=false;form6.k3.Visible :=false;
form6.lk4.Visible:=false;form6.k4.Visible :=false;end;
3:begin form6.lk4.Visible:=false;form6.k4.Visible :=false;end;
end;
end;
procedure kongshu1(); //根據(jù)填空數(shù)目來設(shè)定4個填空框的隱現(xiàn)
begin
case strtoint(form8.kongshu.Text) of
1:begin form8.lk2.Visible :=false;form8.k2.Visible :=false;
form8.lk3.Visible :=false;form8.k3.Visible :=false;
form8.lk4.Visible:=false;form8.k4.Visible :=false;end;
2:begin form8.lk3.Visible :=false;form8.k3.Visible :=false;
form8.lk4.Visible:=false;form8.k4.Visible :=false;end;
3:begin form8.lk4.Visible:=false;form8.k4.Visible :=false;end;
end;
end;
procedure huifu();
begin
form8.lk2.Visible :=true;form8.k2.Visible :=true;
form8.lk3.Visible :=true;form8.k3.Visible :=true;
form8.lk4.Visible :=true;form8.k4.Visible :=true;
end;
procedure TForm8.BitBtn4Click(Sender: TObject);
begin
xuanti.Prior ;
if strtoint(tino.Caption ) >1 then
tino.Caption:= inttostr(strtoint( tino.Caption) -1);
end;
procedure TForm8.nexttiClick(Sender: TObject);
begin
xuanti.next ;
if strtoint(tino.Caption ) <xuanti.RecordCount then
tino.Caption:= inttostr(strtoint( tino.Caption) +1)
else
begin
tino.Caption:='1';
xuanti.Close;
xuanti.Open;
end;
end;
procedure TForm8.BitBtn1Click(Sender: TObject);
begin
huifu();
xuantitian.Prior ;
kongshu1();
if strtoint(tino1.Caption ) >1 then
tino1.Caption:= inttostr(strtoint( tino1.Caption) -1);
end;
procedure TForm8.BitBtn3Click(Sender: TObject);
begin
huifu();
xuantitian.next ;
kongshu1();
if strtoint(tino1.Caption ) <xuantitian.RecordCount then
tino1.Caption:= inttostr(strtoint( tino1.Caption) +1)
else
begin
tino1.Caption:='1';
xuantitian.Close;
xuantitian.Open;
kongshu1();
end;
end;
procedure TForm8.tkClick(Sender: TObject);
begin
xuantitian.SQL.Clear ;
xuantitian.SQL.Add('select * from '+form5.tk.Text );
xuantitian.Open;
shumu1.Caption :=inttostr(xuantitian.RecordCount );
xuanze.Visible :=false;
tiankong.Visible :=true;
kongshu1();
showmessage('請您先選擇本題型分?jǐn)?shù)否則您沒有選擇填空試題的權(quán)利!');
end;
procedure TForm8.xzClick(Sender: TObject);
begin
xuanti.SQL.Clear ;
xuanti.SQL.Add('select * from '+form5.xk.Text );
xuanti.Open;
shumu.Caption :=inttostr(xuanti.RecordCount );
xuanze.Visible :=true;
tiankong.Visible :=false;
end;
procedure TForm8.BitBtn2Click(Sender: TObject);
var
juanno:integer;
begin
inssjk.SQL.Clear ;
inssjk.SQL.Add('delete from 考卷試題庫');
inssjk.ExecSQL ;
xuanti.Next ;
xuanti.Close ;
xuanti.Open;
if not xuantitian.IsEmpty then
begin
xuantitian.Next ;
xuantitian.Close;
xuantitian.Open;
end;
inssjk.SQL.Clear ;
inssjk.SQL.Add('insert into 考卷試題庫(題號,題型,題目,選項A,選項B,選項C,選項D,正確答案,所屬課程) select 題號,題型,題目,選項A,選項B,選項C,選項D,正確答案,所屬課程 from '+form5.xk.Text+' where 是否選中='+''''+'true'+'''');
inssjk.ExecSQL ;
inssjk.SQL.Clear;
inssjk.SQL.Add('insert into 考卷試題庫(題號,題型,題目,選項A,選項B,選項C,選項D,填空數(shù)目,所屬課程) select 題號,題型,題目,空1,空2,空3,空4,填空數(shù)目,所屬課程 from '+form5.tk.Text+' where 是否選中='+''''+'true'+'''');
inssjk.ExecSQL ;
//以試卷的形式表現(xiàn)出來
form5.chuansong.SQL.Clear ;
form5.chuansong.SQL.Add('select * from 考卷試題庫');
form5.chuansong.Open;
if not form5.chuansong.IsEmpty then
begin
form6.show;
inssjk.SQL.Clear ;
inssjk.SQL.Add('select * from 考卷試題庫 where 題型='+''''+'選擇題'+'''');
inssjk.Open;
if not inssjk.IsEmpty then
form6.query1.ParamByName('tixing').AsString :='選擇題'
else
begin
form6.query1.ParamByName('tixing').AsString :='填空';
end;
form6.query1.open;
form6.shumu1.Caption :=inttostr(form6.Query1.RecordCount );
form6.shumu.Caption :=inttostr(form6.Query1.RecordCount );
form6.cunjuan.Visible:=true;
if form5.panel1.tag=0 then
begin
while form5.button3.tag=0 do //隨機(jī)產(chǎn)生試卷號
begin
form5.seljuanno.Close;
juanno:=trunc(random(200))+1;
form5.seljuanno.ParamByName('no').AsString :=inttostr(juanno);
form5.seljuanno.Open;
if form5.seljuanno.IsEmpty then
begin
form6.juanno.Caption:=form6.juanno.Caption +': '+inttostr(juanno);
form5.button3.Tag:=1;
end;
end;
form5.panel1.Tag:=1;
form6.kecheng.Caption:=form6.kecheng.Caption +': '+teacher.ke.Text;
end;
end;
//展示結(jié)束
inssjk.SQL.Clear ;
inssjk.SQL.Add('select * from 考卷試題庫 where 題型='+''''+'選擇題'+'''');
inssjk.Open;
if inssjk.IsEmpty then
begin
form6.xuanze.Visible :=false;
form6.tiankong.Visible :=true;
form6.xz.Visible :=false;
form6.tk.Visible :=false;
kongshu6();
end;
inssjk.SQL.Clear ;
inssjk.SQL.Add('select * from 考卷試題庫 where 題型='+''''+'填空'+'''');
inssjk.Open;
if inssjk.IsEmpty then
begin
form6.xuanze.Visible :=true;
form6.tiankong.Visible :=false;
form6.xz.Visible :=false;
form6.tk.Visible :=false;
end;
form7.tag:=2;
end;
procedure TForm8.FormActivate(Sender: TObject);
begin
showmessage('請您先選擇本題型分?jǐn)?shù)否則您沒有選擇試題的權(quán)利!');
end;
procedure TForm8.xuanzeClick(Sender: TObject);
begin //到下一題
Form8.nexttiClick(Sender);
end;
procedure TForm8.tiankongClick(Sender: TObject);
begin //到下一題
Form8.BitBtn3Click(Sender);
end;
procedure TForm8.xzfChange(Sender: TObject);
begin
if xzf.Text <>'0' then
isxuan.Enabled :=true
else
isxuan.Enabled :=false;
end;
procedure TForm8.tzfChange(Sender: TObject);
begin
if tzf.Text <>'0' then
istian.Enabled :=true
else
istian.Enabled :=false;
end;
procedure TForm8.Button1Click(Sender: TObject);
begin
form8.Close;
xuqiu.show;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -