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

📄 unit8.~pas

📁 本程序提供了考试学生系统的原代码函数,并实现了很多程序难实现的功能
💻 ~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(); //根据填空数目来设定4个填空框的隐现
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(); //根据填空数目来设定4个填空框的隐现
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('请您先选择本题型分数否则您没有选择填空试题的权利!');
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,填空数目,所属课程) select 题号,题型,题目,空1,空2,空3,空4,填空数目,所属课程 from '+form5.tk.Text+' where 是否选中='+''''+'true'+'''');
 inssjk.ExecSQL ;
 //以试卷的形式表现出来
  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 //随机产生试卷号
    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;
 //展示结束
  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('请您先选择本题型分数否则您没有选择试题的权利!');
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.

⌨️ 快捷键说明

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