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

📄 submain.pas

📁 学员管理的软件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
2:
;
end;
temp:=0;
if myfile.ReadBool('other_setting','disable_alttab',false) then
systemparametersinfo(spi_setfasttaskswitch,1,@temp,0);
if myfile.ReadBool('other_setting','disable_ctrlaltdel',false) then
systemparametersinfo(spi_screensaverrunning,1,@temp,0);
myfile.Free;
Canvas.Font := ListBox1.Font;
ListBox1.ItemHeight := Canvas.TextHeight('0');
addcolors('*****************************************************************系统重要通告*****************************************************************',clred);
addcolors('1.本软件适合各个高校的网上考试,主要针对计算机等级考试,高校摸底考试等等...',clgreen);
addcolors('2.本软件采用自动判分和手工判分结合的方式提高试卷总体判分的客观性和准确性',clgreen);
addcolors('3.本软件只供符合操作员和管理员权限的用户使用,目的在于对试卷和试题进行有效的管理和合理的布局',clgreen);
addcolors('4.本软件采用C/S和B/S模式结合方式,考试的人直接通过浏览器完成答题。',clgreen);
addcolors('5.本软件建立试卷时采用随机抽题和手工抽题方式,用户可以任选其一,不过推荐使用人工抽题方式,以便有效掌握试卷的总体难度',clgreen);
addcolors('6.对本软件有任何疑问,可以联系我们,EMAIL:KONGSHANXUELIN@SOHU.COM',clgreen);
addcolors('*************************************************************谢谢使用我们的软件****************************************************************',clred);
addcolors('***********************************************************************************************************************************************',clblue);
addcolors('****************************************************本软件所有解释权归属杭州电子工业学院*******************************************************',clred);
addcolors('***********************************************************************************************************************************************',clblue);
ll:=Tstringlist.Create;
with main.DataModule2 do
begin
  aq1.Close;
  AQ1.SQL.Clear;
  AQ1.SQL.Add('select distinct name from 题库表');
  aq1.Open;
  while not aq1.Eof do
  begin
    ll.Append(aq1.FieldValues['name']);
    aq1.Next;
  end;
end;

for i:=0 to ll.Count-1 do
begin
node:=tv1.Items.Add(tv1.Selected,ll.Strings[i]);
 node.ImageIndex:=0;
 node.SelectedIndex:=0;
    s:=node.Text;
    with main.DataModule2 do
    begin
    aq1.Close;
    aq1.SQL.Clear;
    aq1.SQL.Add('SELECT distinct name from 知识点表');
    aq1.Open;
        while not aq1.Eof do
        begin
         tempnode:=form1.TV1.Items.AddChild(node,aq1.FieldValues['name']);
    //     tempnode.ImageIndex:=1;
   //      tempnode.SelectedIndex:=0;
             s:=tempnode.Text;
             with main.DataModule2 do
             begin
             aq2.Close;
             aq2.SQL.Clear;
             aq2.SQL.Add('SELECT distinct name from 题型表');
             aq2.Open;
             while not aq2.Eof do
             begin
              temppnode.ImageIndex:=1;
           //   tempnode.SelectedIndex:=2;
              temppnode:=form1.TV1.Items.AddChild(tempnode,aq2.FieldValues['name']);
              aq2.Next;
             end;
             end;
         aq1.Next;
        end;
    end;
end;
end;
procedure TForm1.TV1Change(Sender: TObject; Node: TTreeNode);
var
s,str:WideString;
i,num:integer;
l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13:integer;
begin
num:=0;
if node.Level=2 then
begin
tv1.Selected.ImageIndex:=1;
tv1.Selected.SelectedIndex:=2;
end;
if node.Text='快速导航' then
begin
if global.blnopensound then
playsound('click.wav');
dbgrid1.Visible:=false;
panel1.Visible:=true;
end;
if node.Level =2 then
begin
if global.blnopensound then
playsound('change.wav');
dbgrid1.Visible:=true;
panel1.Visible:=false;

str:='';
for i:=0 to u_global_setting.F_setting.selitems.Items.Count -1 do
begin
  if u_global_setting.F_setting.selitems.Checked[i]=true then
  begin
     inc(num);
     if trim(u_global_setting.F_setting.selitems.Items[i])='题型' then
     str:=str+'题型表.name as 题型'+','
     else if trim(u_global_setting.F_setting.selitems.Items[i])='知识点' then
     str:=str+'知识点表.name as 知识点'+','
     else if trim(u_global_setting.F_setting.selitems.Items[i])='所属题库' then
     str:=str+'题库表.name as 所属题库'+','
     else
     str:=str+u_global_setting.F_setting.selitems.Items[i]+',';
  end;
end;
str:=leftstr(str,length(str)-1);
global.selsqlstr:=str;

with main.DataModule2 do
begin
aq2.close;
aq2.SQL.Clear;
s:='SELECT '+str+' ';
s:=s+'from 试题表,知识点表,题型表,题库表';
s:=s+' where 试题表.所属题库=题库表.id and ';
s:=s+'试题表.知识点=知识点表.id and 试题表.题型=题型表.id';
s:=s+' and 题型表.name='''+node.Text +'''';
s:=s+' and 知识点表.name=''';
s:=s+node.Parent.Text+''''+' and 题库表.name=''';
s:=s+node.Parent.Parent.Text+'''';
st_sx.snode:=node.Text;
st_sx.psnode:=node.Parent.Text;
st_sx.ppsnode:=node.Parent.Parent.Text;
aq2.SQL.Add(s);
aq2.Open;
main.DataModule2.DataSource1.DataSet:=aq2;
dbgrid1.DataSource:=main.DataModule2.DataSource1;
end;
end;
for i:=0 to dbgrid1.Columns.Count-1 do
dbgrid1.Columns.Items[i].Width:=100;
end;


procedure TForm1.DBGrid1CellClick(Column: TColumn);
var I:integer;
begin
for i:=0 to dbgrid1.Columns.Count-1 do
begin
 if i=dbgrid1.SelectedIndex then
 begin
 dbgrid1.Columns[i].Font.Color:=clblue;
 dbgrid1.Columns[i].Font.style:=[fsbold];
 dbgrid1.Columns[i].color:=clgray;
 end
 else
 begin
 dbgrid1.Columns[i].Font.Color:=clblack;
 dbgrid1.Columns[i].Font.style:=dbgrid1.Columns[i].Font.style-[fsbold];
 dbgrid1.Columns[i].color:=clwhite;
 end;
end;
end;

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
myfile:Tinifile;
begin
myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
if myfile.ReadBool('form_setting','grid_linecolor',true) then
begin
inherited;
with DBGrid1 do
begin
if((state=[gdselected])or(state=[gdselected,gdfocused])) then
begin
canvas.Font.Color:=clyellow;
canvas.Brush.Color:=clnavy;
end
else
begin
  if main.DataModule2.DataSource1.DataSet.RecNo mod 2 <> 0 then
  canvas.Brush.Color:=clwhite
  else
  canvas.Brush.Color:=$00BFCB73;
end;
DefaultDrawColumnCell(rect,datacol,column,state);
end;
end;
myfile.Free;
end;
procedure TForm1.DBGrid1DblClick(Sender: TObject);
var Column: TColumn ;
begin
try
//if dbgrid1.SelectedField.Value <> NULL then
//begin
column:=dbgrid1.Columns[0];
st_sx.iii:=strtoint(column.Field.Text);
st_sx.Form2.Show;
if global.blnopensound then
playsound('online.wav');
except
//end
//else
//begin
if global.blnopensound then
playsound('beep.wav')
else
;
end;
end;

procedure TForm1.N14Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
sj_zero.Form8.Show;
end;

procedure TForm1.N10Click(Sender: TObject);
var
  bexcelvisible:boolean;
  i,j:Integer;
  titlestr,fvalue,dispstr:string;
  ch:char;
  count:integer;
  s,str:string;
  txid:integer;
  statuspanelwidth:integer;
begin
if global.blnopensound then
playsound('click.wav');
ProgressBar1:=Tprogressbar.Create(self);
statuspanelwidth:=sb.Panels.Items[2].Width;
sb.Panels.Items[2].Width:=150;
sb.Repaint;
with ProgressBar1 do
begin
top:=statusdrawrect.Top;
left:=statusdrawrect.Left;
width:=statusdrawrect.Right-statusdrawrect.Left;
height:=statusdrawrect.Bottom-statusdrawrect.Top;
visible:=true;
parent:=sb;
min:=0;
//max:=100;
step:=1;
end;
s:=inputbox('请选择您要导出的题型','请选择您要导出的题型','单选题');
str:=sb.Panels[0].Text;
sb.Panels[0].Text:='正在转化,请稍候......';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select id from 题型表 where name='''+trim(s)+'''');
adoquery1.Open;
if not adoquery1.Eof then
    txid:=adoquery1.FieldValues['id']
else
begin
messagebox(handle,'未发现数据库中有此题型','错误提示',MB_OK);
exit;
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from 试题表 where 题型='+inttostr(txid));
adoquery1.Open;
while not adoquery1.Eof do
begin
inc(num);
adoquery1.Next;
end;
ProgressBar1.max :=num-1;
progressbar1.Visible:=true;
if application.MessageBox('启动excel么?','咨询信息',MB_YESNO+MB_DEFBUTTON2)<>IDNO then
bexcelvisible:=true
else
bexcelvisible:=false;
try
screen.Cursor:=crhourglass;
excelapplication1.Connect;
except
messagedlg('excel没安装!',MTError,[mbOK],0);
screen.Cursor:=crdefault;
abort;
end;
excelapplication1.Caption:='试题表导出';
excelapplication1.Workbooks.Add(null,0);
excelworkbook1.ConnectTo(excelapplication1.Workbooks[1]);
try
excelworkbook1.Worksheets.Add(null,excelworkbook1.Worksheets[excelworkbook1.Worksheets.Count],null,null,0);
except
application.MessageBox('创建excel新页时失败!','信息',0);
exit;
end;
adotable1.Filter:='题型='+inttostr(txid);
adotable1.Filtered:=true;
excelworksheet1.ConnectTo(excelworkbook1.Worksheets[1] as _worksheet);
excelworksheet1.Range['A1','E1'].Merge(true);
excelworksheet1.Range['A1','D2'].HorizontalAlignment:=$ffffeff4;
excelworksheet1.Cells.Item[1,1].value:=adotable1.TableName+'('+s+')';
i:=2;
count:=adotable1.FieldDefs.Count;
for j:=1 to count do
begin
excelworksheet1.Cells.Item[i,j].value:=adotable1.Fields[j-1].DisplayLabel;
end;
excelworksheet1.Range['A1','D1'].Font.Name:='隶书';
excelworksheet1.Range['A1','D1'].Font.Size:=18;
adotable1.Open;
adotable1.First;
i:=0;
while not adotable1.Eof do
begin
for J:=0 to adotable1.FieldDefs.Count-1 do
begin
if(adotable1.Fields[j].FieldKind=fkcalculated) then
continue;
dispstr:=adotable1.Fields[j].AsString;
excelworksheet1.Cells.Item[i+3,j+1].value:=dispstr;
end;
ProgressBar1.Position:=i;
adotable1.Next;
i:=i+1;
end;
adotable1.close;
screen.Cursor:=crdefault;
if bexcelvisible then
excelapplication1.Visible[0]:=true
else
begin
if savedialog1.Execute then
begin
        try
        excelworksheet1.SaveAs(savedialog1.filename);
        application.MessageBox('保存成功','恭喜',MB_OK);
        except
        application.MessageBox('保存出错','错误',MB_OK);
        end;
end;
//excelworksheet1.Free;
//excelworkbook1.Free;
excelapplication1.Disconnect;
excelapplication1.Quit;
end;
progressbar1.Free;
sb.Panels[0].Text:=str;
end;

procedure TForm1.N17Click(Sender: TObject);
var
  bexcelvisible:boolean;
  i,j:Integer;
  titlestr,fvalue,dispstr:string;
  ch:char;
  count:integer;
  s,ss,str:string;
  sjid:integer;
  statuspanelwidth:integer;
begin
if global.blnopensound then
playsound('click.wav');
ProgressBar1:=Tprogressbar.Create(self);
statuspanelwidth:=sb.Panels.Items[2].Width;
sb.Panels.Items[2].Width:=150;
sb.Repaint;
with ProgressBar1 do
begin
top:=statusdrawrect.Top;
left:=statusdrawrect.Left;
width:=statusdrawrect.Right-statusdrawrect.Left;
height:=statusdrawrect.Bottom-statusdrawrect.Top;
visible:=true;
parent:=sb;
min:=0;
step:=1;
end;
ss:=inputbox('请输入试卷名称','请输入试卷名称','');
if ss<>'' then
begin
str:=sb.Panels[0].Text;
sb.Panels[0].Text:='正在转化,请稍候......';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 试卷号 from 试卷表 where 试卷名称='''+ss+'''');
adoquery1.Open;
if not adoquery1.Eof then
sjid:=adoquery1.FieldValues['试卷号']
else
begin
messagebox(handle,'错误,无此试卷名称','错误名称',MB_OK);
exit;
end;

adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from 用户作答表 where 试卷号='+inttostr(sjid));
adoquery1.Open;
num:=0;

while not adoquery1.Eof do
begin
inc(num);
adoquery1.Next;
end;

progressbar1.Max:=num;
progressbar1.Visible:=true;

if application.MessageBox('启动excel么?','咨询信息',MB_YESNO+MB_DEFBUTTON2)<>IDNO then
bexcelvisible:=true
else
bexcelvisible:=false;

try
screen.Cursor:=crhourglass;
excelapplication1.Connect;
except
messagedlg('excel没安装!',MTError,[mbOK],0);
abort;
end;
excelapplication1.Caption:='试卷表导出';
excelapplication1.Workbooks.Add(null,0);
excelworkbook1.ConnectTo(excelapplication1.Workbooks[1]);

try
excelworkbook1.Worksheets.Add(null,excelworkbook1.Worksheets[excelworkbook1.Worksheets.Count],null,null,0);
except
application.MessageBox('创建excel新页时失败!','信息',0);
exit;
end;

excelworksheet1.ConnectTo(excelworkbook1.Worksheets[1] as _worksheet);
excelworksheet1.Range['A1','E1'].Merge(true);
excelworksheet1.Range['A1','D2'].HorizontalAlignment:=$ffffeff4;
adoquery1.Close;
adoquery1.SQL.Clear;
s:='';
s:='select 题目,题型表.name,选项1,选项2,选项3,选项4,图片,标准答案 from 用户作答表,试题表,题型表 where 题型表.id=试题表.题型 and 用户作答表.题号=试题表.试题号 and 用户作答表.试卷号='+inttostr(sjid);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(s);
excelworksheet1.Cells.Item[1,1].value:=ss;
i:=2;
excelworksheet1.Cells.Item[2,1].value:='题目';
excelworksheet1.Cells.Item[2,2].value:='题型';
excelworksheet1.Cells.Item[2,3].value:='选项1';
excelworksheet1.Cells.Item[2,4].value:='选项2';
excelworksheet1.Cells.Item[2,5].value:='选项3';
excelworksheet1.Cells.Item[2,6].value:='选项4';
excelworksheet1.Cells.Item[2,7].value:='图片';
excelworksheet1.Cells.Item[2,8].value:='标准答案';
excelworksheet1.Range['A1','D1'].Font.Name:='隶书';
excelworksheet1.Range['A1','D1'].Font.Size:=18;
adoquery1.Open;
adoquery1.First;
i:=0;
while not adoquery1.Eof do
begin
for J:=0 to adoquery1.FieldDefs.Count-1 do
begin
if(adoquery1.Fields[j].FieldKind=fkcalculated) then
continue;
dispstr:=adoquery1.Fields[j].AsString;
excelworksheet1.Cells.Item[i+3,j+1].value:=dispstr;
end;
ProgressBar1.Position:=i;
adoquery1.Next;
i:=i+1;
end;
adoquery1.close;
screen.Cursor:=crdefault;
progressbar1.Visible:=false;
if bexcelvisible then
excelapplication1.Visible[0]:=true
else
begin
if savedialog1.Execute then
begin
        try
        excelworksheet1.SaveAs(savedialog1.filename);
        application.MessageBox('保存成功','恭喜',MB_OK);
        except
        application.MessageBox('保存出错','错误',MB_OK);
        end;

⌨️ 快捷键说明

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