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

📄 submain.~pas

📁 学员管理的软件
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:
end;
excelapplication1.Disconnect;
excelapplication1.Quit;
end;
end;
progressbar1.Free;
sb.Panels[0].Text:=str;
end;


procedure TForm1.N2Click(Sender: TObject);
begin
playsound('click.wav');
yh_new.Form10.Show;
end;

procedure TForm1.N91Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
yh_sel.zh_cx.Show;
end;

procedure TForm1.N5Click(Sender: TObject);
begin
if global.blnopensound then
playsound('welcome.wav');
sb.Panels[0].Text:='软件即将关闭,请稍候...';
sb.Update;
sleep(3000);
close;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
  myfile:Tinifile;
  b,bb:boolean;
  reg:Tregistry;
  devmode:Tdevicemode;
begin
mcisendstring(pchar('close click.wav'),nil,0,0);
mcisendstring(pchar('close welcome.wav'),nil,0,0);
mcisendstring(pchar('close retry.wav'),nil,0,0);
mcisendstring(pchar('close btnFocus.wav'),nil,0,0);
mcisendstring(pchar('close change.wav'),nil,0,0);
mcisendstring(pchar('close undo.wav'),nil,0,0);
mcisendstring(pchar('close beep.wav'),nil,0,0);
mcisendstring(pchar('close online.wav'),nil,0,0);
if enumdisplaysettings(nil,0,devmode) then
begin
devmode.dmFields:=dm_pelswidth or dm_pelsheight;
devmode.dmPelsWidth:=olddisplaywidth;
devmode.dmPelsHeight:=olddisplayheight;
if changedisplaysettings(devmode,cds_test)=disp_change_successful then
changedisplaysettings(devmode,cds_updateregistry);
end;
myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
b:=myfile.readbool('option','auto_run',false);
bb:=myfile.readbool('option','auto_shutdown',false);
myfile.Free;
if b then
begin
reg:=Tregistry.Create;
reg.RootKey:=HKEY_LOCAL_MACHINE;
reg.OpenKey('\SOFTWARE\Microsoft\Windows\CurrentVersion\Run',true);
reg.WriteString(caption,application.ExeName);
reg.CloseKey;
end;
if bb then
begin
if MessageDlg('真的要关闭计算机么?',
    mtConfirmation, [mbYes, mbNo],0) = mrYes then
begin
EXITWINDOWSEX(EWX_SHUTDOWN,0);
end;
end;
application.Terminate;
end;

procedure TForm1.FormShow(Sender: TObject);
var
qx:string;
myfile:Tinifile;
begin
//n14.ShortCut:='F4';
label3_str:=trim(login.form_logon.name.Text);
label4_str:=trim(login.form_logon.jb.Text);
qx:=trim(login.form_logon.jb.Text);
if qx='考试人' then
begin
N2.Visible:=false;
T1.Visible:=false;
q1.Visible:=FALSE;
N21.Visible:=false;
N22.Visible:=false;
tv1.Enabled:=false;
dbgrid1.Enabled:=false;
end;
if qx='操作员' then
begin
N2.Visible:=false;
T1.Visible:=true;
q1.Visible:=true;
N21.Visible:=false;
N22.Visible:=false;
tv1.Enabled:=true;
dbgrid1.Enabled:=true;
end;
if qx='管理员' then
begin
N2.Visible:=true;
T1.Visible:=true;
q1.Visible:=true;
N21.Visible:=true;
N22.Visible:=true;
tv1.Enabled:=true;
dbgrid1.Enabled:=true;
end;
sb.Panels[0].Text:='当前登陆者:'+login.form_logon.name.Text;
sb.Panels[1].Text:='权限:'+login.form_logon.jb.Text;
label3.Caption:= login.form_logon.name.Text;
label4.Caption:= login.form_logon.jb.Text;
myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'tip.ini');
if myfile.ReadBool('tip','show',true) then
begin
U_tip.F_tip_form.Hide;
AnimateWindow(F_tip_form.Handle,1000,AW_CENTER);
U_tip.F_tip_form.Show;
end;
myfile.Free;
end;

procedure TForm1.N4Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
hide;
login.form_logon.ShowModal;
end;

procedure TForm1.N20Click(Sender: TObject);
var
ss,s,tempstr:string;
f:Textfile;
i,sjid:integer;
str:string;
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;

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;
screen.Cursor:=crhourglass;
savedialog1.DefaultExt:='txt';
if savedialog1.Execute then
begin
assignfile(f,savedialog1.FileName);
end;
rewrite(f);
writeln(f,ss);
writeln(f,'-----------------------------------------------------------------------------------------');
writeln(f,'题目',#9#9#9#9,'题型',#9#9#9#9,'选项1',#9#9#9,'选项2',#9#9#9,'选项3',#9#9#9,'选项4',#9#9#9,'图片',#9#9#9,'标准答案');
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);
adoquery1.Open;
adoquery1.First;
while not adoquery1.Eof do
begin
tempstr:='';
tempstr:=adoquery1.FieldValues['题目'];
tempstr:=tempstr+#9#9#9#9+adoquery1.FieldValues['name'];
tempstr:=tempstr+#9#9#9#9+adoquery1.FieldValues['选项1'];
tempstr:=tempstr+#9#9#9+adoquery1.FieldValues['选项2'];
tempstr:=tempstr+#9#9#9+adoquery1.FieldValues['选项3'];
tempstr:=tempstr+#9#9#9+adoquery1.FieldValues['选项4'];
tempstr:=tempstr+#9#9#9+adoquery1.FieldValues['图片'];
tempstr:=tempstr+#9#9#9+adoquery1.FieldValues['标准答案'];
writeln(f,tempstr);
adoquery1.Next;
ProgressBar1.Position:=i;
inc(i);
end;
closefile(f);
sb.Panels[0].Text:=str;
adoquery1.close;
end;
screen.Cursor:=crdefault;
progressbar1.Free;
end;

procedure TForm1.N28Click(Sender: TObject);
var
s:string;
i,code:Integer;
begin
(*
s:=inputbox('请输入几分钟','请输入分钟数','150');
min:=s;
val(s,i,code);
if code<>0 then
begin
   N25.Enabled:=false;
   messagedlg('你输入的字符串中包含非法字符'+#13+#10+
              '请重新输入'+#13+#10+'不合法字符位置第'+inttostr(code)+'位',mtwarning,[mbok],0);
   exit;
end;
N25.Enabled:=true;
*)
end;

procedure TForm1.N25Click(Sender: TObject);
var
s:string;
myfile:Tinifile;
begin
if messagedlg('你需要设置虚拟目录么?',mtinformation,[mbyes,mbno],0)=mryes then
begin
  s:=inputbox('提示','请输入虚拟目录名','');
  myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
  myfile.WriteString('iis_path','path',s);
  myfile.Free;
  shellexecute(handle,'open',pchar('http://localhost/'+s+'/index.asp'),nil,nil,sw_normal);
end
else
begin
  myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
  s:=myfile.ReadString('iis_path','path','');
  myfile.Free;
  if (s='') then
  begin
    if messagedlg('虚拟目录名没配置,是否确定无须配置?',mtinformation,[mbyes,mbno],0)=mryes then
    begin
       shellexecute(handle,'open','http://localhost/index.asp',nil,nil,sw_normal);
       exit
    end
    else
       exit;
  end;
  shellexecute(handle,'open',pchar('http://localhost/'+s+'/index.asp'),nil,nil,sw_normal);
end;
end;

procedure TForm1.WORD1Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
p_word_set.word_set.show;
end;

procedure TForm1.N21Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
shellexecute(handle,'open','backup_db.exe',nil,nil,sw_normal);
end;

procedure TForm1.N22Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
shellexecute(handle,'open','P_restore.exe',nil,nil,sw_normal);
end;

procedure TForm1.N6Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
P_st_insert.st_insert.Show;
end;

procedure TForm1.N7Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
P_st_oper.st_oper.Show;
end;

procedure TForm1.ListView1DblClick(Sender: TObject);
begin
case listview1.Selected.Index of
0:
messagebox(handle,'导出到EXCEL图标,可以是试题和试卷','信息',MB_OK);
1:
messagebox(handle,'图表统计,主要是对各题型统计等...','信息',MB_OK);
2:
messagebox(handle,'包括各种形式的报表,都用此图标','信息',MB_OK);
3:
messagebox(handle,'新建试卷,可以通过工具栏和菜单栏选择','信息',MB_OK);
4:
messagebox(handle,'退出本软件','信息',MB_OK);
5:
messagebox(handle,'包括试题,试卷等的查询,都用此图标','信息',MB_OK);
6:
messagebox(handle,'建立一张新的试卷','信息',MB_OK);
7:
messagebox(handle,'注销本次登陆','信息',MB_OK);
8:
messagebox(handle,'导出到TXT图标,可以是试题和试卷','信息',MB_OK);
9:
messagebox(handle,'导出到WORD图标,可以是试题和试卷','信息',MB_OK);
10:
messagebox(handle,'系统帮助','信息',MB_OK);
11:
messagebox(handle,'贴加新的用户','信息',MB_OK);
12:
messagebox(handle,'对试题的一系列查询等操作,包括编辑等...','信息',MB_OK);
end;
end;

procedure Tform1.AddColors(s:string;colors:Tcolor);
begin
     ListBox1.Items.AddObject (
      s,
      TObject(Colors));
end;

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
 with Control as TListbox do
  begin
    Canvas.FillRect (Rect);
    Canvas.Font.Color := TColor (
      Items.Objects [Index]);
    Canvas.TextOut(Rect.Left, Rect.Top,
      Listbox1.Items[Index]);
    if (odFocused in State) and (odSelected in State) then
      Canvas.DrawFocusRect (Rect);
   end;
end;

procedure TForm1.sbDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel;
  const Rect: TRect);
begin
if panel=sb.Panels.Items[2] then
begin
statusdrawrect:=rect;
exit;
end;
end;

procedure TForm1.N31Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
shellexecute(handle,'open','P_db_set.exe',nil,nil,sw_normal);
end;

procedure TForm1.N34Click(Sender: TObject);
begin
if global.blnopensound then
playsound('retry.wav');
sj_four_rand.T_txtj.Show;
end;

procedure TForm1.N41Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
P_DB_manage.F_about.Show;
end;

procedure TForm1.N43Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
shellexecute(handle,'open','http://www.404guy.com',nil,nil,sw_normal);
end;

procedure TForm1.N51Click(Sender: TObject);
begin
if colordialog1.Execute then
  tv1.Color:=colordialog1.Color;
end;

procedure TForm1.N46Click(Sender: TObject);
begin
if N46.Checked then
begin
tv1.ShowLines:=false;
N46.Caption:='无线';
N46.Checked:=not N46.Checked;
end
else
begin
tv1.ShowLines:=true;
N46.Caption:='有线';
N46.Checked:=not N46.Checked;
end;
end;

procedure TForm1.N47Click(Sender: TObject);
begin
if N47.Checked then
begin
tv1.ShowButtons:=false;
N47.Caption:='无+/-';
N47.Checked:=not N47.Checked;
end
else
begin
tv1.ShowButtons :=true;
N47.Caption:='有+/-';
N47.Checked:=not N47.Checked;
end;

end;

procedure TForm1.N49Click(Sender: TObject);
begin
tv1.Color:=clSkyBlue;
end;

procedure TForm1.N50Click(Sender: TObject);
begin
tv1.Color:=clbtnface;
end;

procedure Tform1.tvfresh;
var
  node,tempnode,temppnode:Ttreenode;
  ll:Tstringlist;
  i:integer;
  s:string;
begin
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;

⌨️ 快捷键说明

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