|
发表于 2013-8-28 15:52:00
|
显示全部楼层
本帖最后由 yangdai 于 2013-8-28 15:57 编辑
參考看看.別問我.好久以前寫得.忘光了
#include <GUIConstants.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <Array.au3>
#include <IE.au3>
Global $D[10]
Global $Code[100]
Global $TCode[1000]
Global $D_cnt=0
Global $SEL=1
Global $PAGE=0
Global $st
Global $mark[100]
INIT_CONN()
dim $radio1
dim $radio2
dim $radio3
dim $radio4
dim $radio5
dim $radio6
dim $Next1
Global $FORWARD
dim $GROUP1
dim $Label1
dim $Label2
dim $Label3
dim $page1_init=0 , $page2_init=0 , $page3_init=0
;---2
dim $Next2
dim $Combo1
dim $Combo2
dim $Combo3
dim $Combo4
dim $Combo5
dim $LabeZ1
dim $LabeZ2
dim $LabeZ3
dim $LabeZ4
dim $LabeZ5
dim $LabeZ6
dim $LabeZ7
dim $LabeZ8
dim $LabeZ9
dim $LabeZ10
dim $LabeZ11
dim $sd1_ct=0
dim $sd2_ct=0
dim $sd3_ct=0
dim $sd4_ct=0
dim $sd5_ct=0
dim $eazy_1=0
dim $eazy_2=0
dim $eazy_3=0
dim $eazy_4=0
dim $eazy_5=0
dim $eazy_0=0
dim $score=0
dim $eazy_deg=0
dim $div_score=0
; page3
dim $PicT1
dim $PicT2
dim $PicT3
dim $PicL
dim $PicR
dim $Input1
dim $Input2
init_MARK()
$Form1 = GUICreate("維新書局", 860, 640, -1,-1)
GUISetCursor (2)
GUICtrlSetCursor (-1,2)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$PIC0= GUICtrlCreatePic("0.jpg",0,0, 860, 640)
GuiCtrlSetState(-1,$GUI_DISABLE)
$PICT1= GUICtrlCreatePic("T1.jpg",225,110, 360, 40)
GuiCtrlSetState(-1,$GUI_HIDE)
$PICT2= GUICtrlCreatePic("T2.jpg",225,110, 360, 76)
GuiCtrlSetState(-1,$GUI_HIDE)
$PICT3= GUICtrlCreatePic("T3.jpg",225,110, 360, 160)
GuiCtrlSetState(-1,$GUI_DISABLE)
GuiCtrlSetState(-1,$GUI_HIDE)
$PicP = GUICtrlCreatePic("PRINTER.jpg", 160, 104, 289, 209)
GuiCtrlSetState(-1,$GUI_HIDE)
; 方向
$NEXT1 = GUICtrlCreatePic("R.jpg", 540, 470, 60, 40)
GUICtrlSetCursor (-1, 0)
GuiCtrlSetState(-1,$GUI_HIDE)
$NEXT2 = GUICtrlCreatePic("R.jpg", 540, 470, 60, 40)
GUICtrlSetCursor (-1, 0)
GuiCtrlSetState(-1,$GUI_HIDE)
$FORWARD = GUICtrlCreatePic("L.jpg", 210, 470, 60, 45)
GUICtrlSetCursor (-1, 0)
GuiCtrlSetState(-1,$GUI_HIDE)
$FORWARD2 = GUICtrlCreatePic("L.jpg", 210, 470, 60, 45)
GUICtrlSetCursor (-1, 0)
GuiCtrlSetState(-1,$GUI_HIDE)
; page2
$LabeZ1 = GUICtrlCreateLabel("最難", 256, 208, 50, 28)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 14, 400, 0, "標楷體")
$LabeZ2 = GUICtrlCreateLabel("難", 256, 258, 24, 28)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 14, 400, 0, "標楷體")
$LabeZ3 = GUICtrlCreateLabel("普通", 256, 308, 50, 28)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 14, 400, 0, "標楷體")
$LabeZ4 = GUICtrlCreateLabel("易", 256, 358, 24, 28)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 14, 400, 0, "標楷體")
$LabeZ5 = GUICtrlCreateLabel("最易",256, 408, 50, 28)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 14, 400, 0, "標楷體")
;$LabeZ6 = GUICtrlCreateLabel("題數:", 88, 48, 80, 33)
$LabeZ7 = GUICtrlCreateLabel("0", 292, 158, 40, 33)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 16, 400, 0, "標楷體")
;$LabeZ8 = GUICtrlCreateLabel("配分:", 237, 48, 80, 33)
$LabeZ9 = GUICtrlCreateLabel("0", 406, 158, 40, 33)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 16, 400, 0, "標楷體")
;$LabeZ10 = GUICtrlCreateLabel("總分:", 400, 48, 80, 33)
$LabeZ11 = GUICtrlCreateLabel("0", 524, 158, 40, 33)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 16, 400, 0, "標楷體")
hide_combo()
;PAGE3
$PicP= GUICtrlCreatePic("PRINTER.jpg", 310, 308, 200,200)
GUICtrlSetCursor (-1, 0)
GuiCtrlSetState(-1,$GUI_HIDE)
$Input1 = GUICtrlCreateInput("", 214, 190, 153, 34)
GUICtrlSetFont(-1, 16, 400, 0, "標楷體")
GuiCtrlSetState(-1,$GUI_HIDE)
$Input2 = GUICtrlCreateInput("", 214, 242, 153, 34)
GUICtrlSetFont(-1, 16, 400, 0, "標楷體")
GuiCtrlSetState(-1,$GUI_HIDE)
SET_PAGE1()
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
if $page=1 then
Switch $nMsg
Case $GUI_EVENT_CLOSE
EXIT
Case $Radio1
$SEL=1
if $d_cnt<>0 then
CLEAR_CHECKBOX()
endif
INIT_DTOHLC()
Case $Radio2
$SEL=2
if $d_cnt<>0 then
CLEAR_CHECKBOX()
endif
INIT_DTOHLC()
Case $Radio3
$SEL=3
if $d_cnt<>0 then
CLEAR_CHECKBOX()
endif
INIT_DTOHLC()
Case $Radio4
$SEL=4
if $d_cnt<>0 then
CLEAR_CHECKBOX()
endif
INIT_DTOHLC()
; Case $Radio5
; $SEL=5
; if $d_cnt<>0 then
; CLEAR_CHECKBOX()
; endif
; INIT_DTOHLC()
; Case $Radio6
; $SEL=6
; if $d_cnt<>0 then
; CLEAR_CHECKBOX()
; endif
; INIT_DTOHLC()
Case $NEXT1
hide_RADIO()
hide_CHECKBOX()
show_Combo()
SET_PAGE2()
sleep(1000)
EndSwitch
endif
if $page=2 then
Switch $nMsg
Case $GUI_EVENT_CLOSE
EXIT
Case $Combo1
get_score()
Case $Combo2
get_score()
Case $Combo3
get_score()
Case $Combo4
get_score()
Case $Combo5
get_score()
Case $FORWARD
hide_Combo()
show_RADIO()
show_CHECKBOX()
SET_PAGE1()
Case $NEXT2
hide_Combo()
SET_PAGE3()
EndSwitch
endif
if $page=3 then
Switch $nMsg
Case $GUI_EVENT_CLOSE
EXIT
Case $PicP
IF $eazy_0>0 THEN
MAke_Paper()
ELSE
MSGBOX(0,0,"題數=0無法列印,請重新設定")
ENDIF
Case $FORWARD2
GUICtrlSetState($PicP, $GUI_HIDE)
GUICtrlSetState($input1, $GUI_HIDE)
GUICtrlSetState($input2, $GUI_HIDE)
SET_PAGE2()
EndSwitch
endif
WEnd
Func CLEAR_CHECKBOX()
for $i=1 to $d_cnt
GUICtrlDelete($D[$i])
next
endfunc
Func HIDE_CHECKBOX()
for $i=1 to $d_cnt
GUICtrlSetState ($D[$i], $GUI_HIDE)
next
endfunc
Func SHOW_CHECKBOX()
for $i=1 to $d_cnt
GUICtrlSetState ($D[$i], $GUI_SHOW)
next
endfunc
Func HIDE_radio()
; GUICtrlSetState($Group1, $GUI_HIDE)
GUICtrlSetState($Radio1, $GUI_HIDE)
GUICtrlSetState($Radio2, $GUI_HIDE)
GUICtrlSetState($Radio3, $GUI_HIDE)
GUICtrlSetState($Radio4, $GUI_HIDE)
GUICtrlSetState($Radio5, $GUI_HIDE)
GUICtrlSetState($Radio6, $GUI_HIDE)
endfunc
Func SHOW_radio()
GUICtrlSetState($Radio1, $GUI_SHOW)
GUICtrlSetState($Radio2, $GUI_SHOW)
GUICtrlSetState($Radio3, $GUI_SHOW)
GUICtrlSetState($Radio4, $GUI_SHOW)
GUICtrlSetState($Radio5, $GUI_SHOW)
GUICtrlSetState($Radio6, $GUI_SHOW)
endfunc
Func HIDE_Combo()
; clear_Combo()
GUICtrlSetState($Combo1, $GUI_HIDE)
GUICtrlSetState($Combo2, $GUI_HIDE)
GUICtrlSetState($Combo3, $GUI_HIDE)
GUICtrlSetState($Combo4, $GUI_HIDE)
GUICtrlSetState($Combo5, $GUI_HIDE)
GUICtrlSetState($LabeZ1, $GUI_HIDE)
GUICtrlSetState($LabeZ2, $GUI_HIDE)
GUICtrlSetState($LabeZ3, $GUI_HIDE)
GUICtrlSetState($LabeZ4, $GUI_HIDE)
GUICtrlSetState($LabeZ5, $GUI_HIDE)
GUICtrlSetState($LabeZ7 , $GUI_HIDE)
GUICtrlSetState($LabeZ9 , $GUI_HIDE)
GUICtrlSetState($LabeZ11, $GUI_HIDE)
GUISetState(@SW_SHOW)
endfunc
Func SHOW_Combo()
GUICtrlSetState($Combo1, $GUI_SHOW)
GUICtrlSetState($Combo2, $GUI_SHOW)
GUICtrlSetState($Combo3, $GUI_SHOW)
GUICtrlSetState($Combo4, $GUI_SHOW)
GUICtrlSetState($Combo5, $GUI_SHOW)
GUICtrlSetState($LabeZ1, $GUI_SHOW)
GUICtrlSetState($LabeZ2, $GUI_SHOW)
GUICtrlSetState($LabeZ3, $GUI_SHOW)
GUICtrlSetState($LabeZ4, $GUI_SHOW)
GUICtrlSetState($LabeZ5, $GUI_SHOW)
GUICtrlSetState($LabeZ7 ,$GUI_SHOW)
GUICtrlSetState($LabeZ9 ,$GUI_SHOW)
GUICtrlSetState($LabeZ11,$GUI_SHOW)
GUISetState(@SW_SHOW)
endfunc
Func CREATE_Combo()
$Combo1 = GUICtrlCreateCombo("", 337, 204,60, 193)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1,0x6500FE)
GUICtrlSetBkColor(-1, 0x9DB9EB)
$Combo2 = GUICtrlCreateCombo("", 337, 254, 60, 193)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1,0x6500FE)
GUICtrlSetBkColor(-1, 0x9DB9EB)
$Combo3 = GUICtrlCreateCombo("", 337, 304, 60, 193)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1,0x6500FE)
GUICtrlSetBkColor(-1, 0x9DB9EB)
$Combo4 = GUICtrlCreateCombo("", 337, 354, 60, 193)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1,0x6500FE)
GUICtrlSetBkColor(-1, 0x9DB9EB)
$Combo5 = GUICtrlCreateCombo("", 337, 404, 60, 193)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1,0x6500FE)
GUICtrlSetBkColor(-1, 0x9DB9EB)
GUISetState(@SW_SHOW)
endfunc
Func CLEAR_Combo()
GUICtrlDelete($Combo1)
GUICtrlDelete($Combo2)
GUICtrlDelete($Combo3)
GUICtrlDelete($Combo4)
GUICtrlDelete($Combo5)
GUISetState(@SW_SHOW)
endfunc
Func GET_CHECKBOX()
for $i=1 to $d_cnt
$C=GUICtrlRead($D[$i])
if $C=1 then
endif
next
endfunc
Func INIT_CONN()
Const $mdb_data_path="EV.mdb"
Global $conn,$RS
$conn = ObjCreate("ADODB.Connection")
$conn.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
$RS =ObjCreate("ADODB.Recordset")
$RS2 =ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $conn
endfunc
Func INIT_DTOHLC()
$mtable="T_title"
$RS.Open ("Select count(*) From " & $mtable & " where catg_code=" & $sel )
$cnt=$RS.Fields(0).Value
$D_cnt=$cnt
redim $D[$cnt+1]
redim $Code[$cnt+1]
$RS.close
$RS.Open ("Select * From " & $mtable & " where catg_code=" & $sel & " order by title_code" )
$i=0
$x=240
$y=174
$h=26
while not $rs.eof and not $rs.bof
if @error =1 Then ExitLoop
$i=$i+1
$S =$RS.Fields("title_name").Value
$code[$i] =$RS.Fields("title_code").Value
if $i>10 then
$D[$i] = GUICtrlCreateCheckbox($S, $x, $y+$h*$i, 300, 36)
else
$D[$i] = GUICtrlCreateCheckbox($S, $x, $y+$h*$i, 360, 36)
endif
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 9.5, 400, 0, "細明體")
$rs.movenext
WEnd
$RS.close
GuiCtrlSetState($NEXT1,$GUI_show)
endfunc
Func SET_PAGE1()
GUICtrlSetCursor (-1, 2)
GuiCtrlSetState($PICt1,$GUI_show)
GuiCtrlSetState($PICt2,$GUI_hide)
GuiCtrlSetState($PICt3,$GUI_hide)
GUICtrlSetBkColor($Label1,0xFFFF00)
GUICtrlSetBkColor($Label2,0x9DB9EB)
GUICtrlSetBkColor($Label3,0x9DB9EB)
if $page=0 then
$Radio1 = GUICtrlCreateRadio("一年級上學期", 240, 150, 153, 25)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 12, 400, 0, "標楷體")
$Radio2 = GUICtrlCreateRadio("一年級下學期", 240, 176, 153, 25)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 12, 400, 0, "標楷體")
$Radio3 = GUICtrlCreateRadio("二年級上學期", 420, 150, 153, 25)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 12, 400, 0, "標楷體")
$Radio4 = GUICtrlCreateRadio("二年級下學期", 420, 176, 153, 25)
GUICtrlSetColor(-1,0xFFEF89)
GUICtrlSetBkColor(-1, 0x6500FE)
GUICtrlSetFont(-1, 12, 400, 0, "標楷體")
; $Radio5 = GUICtrlCreateRadio("三年級上學期", 439, 80, 153, 25)
; GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
; $Radio6 = GUICtrlCreateRadio("三年級下學期", 439, 112, 153, 25)
; GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
endif
$page=1
GUICtrlSetState ($FORWARD, $GUI_HIDE)
GUICtrlSetState ($FORWARD2, $GUI_HIDE)
GUICtrlSetState ($NEXT1, $GUI_SHOW)
GUICtrlSetState ($NEXT2, $GUI_HIDE)
GUISetState(@SW_SHOW)
endfunc
Func SET_PAGE2()
GuiCtrlSetState($PICt1,$GUI_hide)
GuiCtrlSetState($PICt2,$GUI_show)
GuiCtrlSetState($PICt3,$GUI_hide)
if $page=1 then
CLEAR_Combo()
CREATE_Combo()
set_Combo()
else
SHOW_Combo()
endif
$page=2
GUICtrlSetState ($FORWARD2, $GUI_hide)
GUICtrlSetState ($FORWARD, $GUI_SHOW)
GUICtrlSetState ($NEXT2, $GUI_SHOW)
GUICtrlSetState ($NEXT1, $GUI_HIDE)
GUISetState(@SW_SHOW)
endfunc
Func SET_PAGE3()
GuiCtrlSetState($PICt1,$GUI_hide)
GuiCtrlSetState($PICt2,$GUI_hide)
GuiCtrlSetState($PICt3,$GUI_show)
GUICtrlSetState($input1, $GUI_show)
GUICtrlSetState($input2, $GUI_show)
; GUISetCursor (2)
GUICtrlSetState ($PicP, $GUI_SHOW)
GUICtrlSetTip(-1, "印製試卷")
GUICtrlSetCursor (-1, 2)
GUICtrlSetState ($FORWARD2, $GUI_SHOW)
GUICtrlSetState ($NEXT2, $GUI_HIDE)
GUICtrlSetState ($FORWARD, $GUI_hide)
hide_combo()
$page=3
GUISetState(@SW_SHOW)
endfunc
Func set_Combo()
$mtable="T_QUEST"
$st="'-999"
$sd1_ct=0
$sd2_ct=0
$sd3_ct=0
$sd4_ct=0
$sd5_ct=0
for $i=1 to $d_cnt
$C=GUICtrlRead($D[$i])
if $C=1 then
$st= $st & "','" & $Code[$i]
endif
next
$st= $st & "'"
$sql="Select count(*) as ct From " & $mtable & " where Code in (" & $st & ")" & " and eazy='1'"
$RS.Open ($sql)
if not $rs.eof then
$sd1_ct=$RS("ct").value
endif
$RS.close
$sql="Select count(*) as ct From " & $mtable & " where Code in (" & $st & ")" & " and eazy='2'"
$RS.Open ($sql)
if not $rs.eof then
$sd2_ct=$RS("ct").value
endif
$RS.close
$sql="Select count(*) as ct From " & $mtable & " where Code in (" & $st & ")" & " and eazy='3'"
$RS.Open ($sql)
if not $rs.eof then
$sd3_ct=$RS("ct").value
endif
$RS.close
$sql="Select count(*) as ct From " & $mtable & " where Code in (" & $st & ")" & " and eazy='4'"
$RS.Open ($sql)
if not $rs.eof then
$sd4_ct=$RS("ct").value
endif
$RS.close
$sql="Select count(*) as ct From " & $mtable & " where Code in (" & $st & ")" & " and eazy='5'"
$RS.Open ($sql)
if not $rs.eof then
$sd5_ct=$RS("ct").value
endif
$RS.close
$s=get_dig($sd1_ct)
GUICtrlSetData($combo1, $s,$sd1_ct)
$s=get_dig($sd2_ct)
GUICtrlSetData($combo2, $s,$sd2_ct)
$s=get_dig($sd3_ct)
GUICtrlSetData($combo3, $s,$sd3_ct)
$s=get_dig($sd4_ct)
GUICtrlSetData($combo4, $s,$sd4_ct)
$s=get_dig($sd5_ct)
GUICtrlSetData($combo5, $s,$sd5_ct)
; msgbox(0,0,$s)
get_score()
GUISetState(@SW_SHOW)
endfunc
Func get_dig($v)
$e="0"
for $i=1 to $v
$e=$e & "|" & string($i)
next
return $e
endfunc
Func get_score()
$eazy_1=GUICtrlRead($combo1)
$eazy_2=GUICtrlRead($combo2)
$eazy_3=GUICtrlRead($combo3)
$eazy_4=GUICtrlRead($combo4)
$eazy_5=GUICtrlRead($combo5)
$eazy_0=$eazy_1+$eazy_2+$eazy_3+$eazy_4+$eazy_5 ; 題數
if $eazy_0<>0 then
$div_score=round(100/$eazy_0,1)
else
$div_score=0
endif
$score=$div_score*$eazy_0
$eazy_deg=($eazy_1*5+$eazy_2*4+$eazy_3*3+$eazy_4*2+$eazy_5*1)/(15*$eazy_0)
GUICtrlSetData ($LabeZ7,$eazy_0) ; 題數
GUICtrlSetData ($LabeZ9,$div_score) ; 配分
GUICtrlSetData ($LabeZ11,$score) ; 總分
return
endfunc
Func MAke_Paper()
redim $Tcode[$eazy_0+1]
$mtable="T_quest"
SRandom(_MSec())
$rand=round(Random(10000,999999),0)
$sql="Select top " & $eazy_1 & " * From " & $mtable & " where Code in (" & $st & ") and eazy='5' order by Rnd(Q_code+" & $rand & ")"
$RS.Open ($sql)
$i=0
while not $rs.eof and not $rs.bof
if @error =1 Then ExitLoop
$i=$i+1
$Tcode[$i] =$RS.Fields("code").Value & "," & $RS.Fields("cno").Value
$rs.movenext
WEnd
$RS.close
$sql="Select top " & $eazy_2 & " * From " & $mtable & " where Code in (" & $st & ") and eazy='4' order by Rnd(Q_code+" & $rand & ")"
$RS.Open ($sql)
while not $rs.eof and not $rs.bof
if @error =1 Then ExitLoop
$i=$i+1
$Tcode[$i] =$RS.Fields("code").Value & "," & $RS.Fields("cno").Value
$rs.movenext
WEnd
$RS.close
$sql="Select top " & $eazy_3 & " * From " & $mtable & " where Code in (" & $st & ") and eazy='3' order by Rnd(Q_code+" & $rand & ")"
$RS.Open ($sql)
while not $rs.eof and not $rs.bof
if @error =1 Then ExitLoop
$i=$i+1
$Tcode[$i] =$RS.Fields("code").Value & "," & $RS.Fields("cno").Value
$rs.movenext
WEnd
$RS.close
$sql="Select top " & $eazy_4 & " * From " & $mtable & " where Code in (" & $st & ") and eazy='2' order by Rnd(Q_code+" & $rand & ")"
$RS.Open ($sql)
while not $rs.eof and not $rs.bof
if @error =1 Then ExitLoop
$i=$i+1
$Tcode[$i] =$RS.Fields("code").Value & "," & $RS.Fields("cno").Value
$rs.movenext
WEnd
$RS.close
$sql="Select top " & $eazy_5 & " * From " & $mtable & " where Code in (" & $st & ") and eazy='1' order by Rnd(Q_code+" & $rand & ")"
$RS.Open ($sql)
while not $rs.eof and not $rs.bof
if @error =1 Then ExitLoop
$i=$i+1
$Tcode[$i] =$RS.Fields("code").Value & "," & $RS.Fields("cno").Value
$rs.movenext
WEnd
$RS.close
_ArraySort($Tcode)
; _Arraydisplay($Tcode)
$pa="<HTML><head><meta http-equiv=pragma content=nocache>"
$pa=$pa & "<meta http-equiv=Content-Type content=text/html; charset=UTF-8 />"
$pa=$pa & "</head><TITLE>體育學科測驗</TITLE><body>"
$TXT1=GUICtrlRead($input1)
$TXT2=GUICtrlRead($input2)
$pb=$pa & "<center><TABLE WIDTH= 98% BORDER=0><tr><th><BIG>" & $TXT1 & "高中" & $TXT2 & "學年" & "體育學科測驗答案卷</big></Th></TR></TABLE><table width=98% BORDER=0 >"
$pa=$pa & "<center><TABLE WIDTH= 98% BORDER=0><tr><th><BIG>" & $TXT1 & "高中" & $TXT2 & "學年" & "體育學科測驗</big></Th></TR></TABLE><table width=98% BORDER=0 >"
for $i=1 to ubound($Tcode) -1
$tv=stringsplit($Tcode[$i],",")
$sql="select q.quest,q.ans,c.choice,q.code from t_quest q,t_choice c where Q.code= '" & $tv[1] & "'"
$sql=$sql & " and q.cno='" & $tv[2] & "'"
$sql=$sql & " and q.code=c.code"
$sql=$sql & " and q.cno=c.cno"
$sql=$sql & " order by c.sno"
; msgbox(0,0,ubound($Tcode)-1)
; msgbox(0,0,$sql)
$RS.Open ($sql)
if not $rs.eof and not $rs.bof then
$pa=$pa & "<TR valign=top><td nowrap>( )" & $i & ".<td>" & $RS.Fields("quest").Value & "<TR valign=top><td> <TD>"
$pB=$pB & "<TR valign=top><td nowrap>(" & $RS.Fields("ans").Value & ")" & $i & ".<td>" & $RS.Fields("quest").Value & "<TR valign=top><td> <TD>"
$j=1
while not $rs.eof and not $rs.bof
$pa=$pa & $mark[$j] & $RS.Fields("choice").Value
$pB=$pB & $mark[$j] & $RS.Fields("choice").Value
$j=$J+1
$rs.movenext
WEnd
$pa=$pa & "</td></TR>"
$pB=$pB & "</td></TR>"
; $pa=$pa & "<BR>"
$RS.close
else
msgbox(0,0,$sql)
endif
next
$pa=$pa & "</table></center>"
$pa=$pa & "</body></html>"
$pB=$pB & "</table></center>"
$pB=$pB & "</body></html>"
; msgbox(0,0,$pa)
$oIE = _IECreate ()
_IEDocWriteHTML ($oIE, $pa)
$oIE = _IECreate ()
_IEDocWriteHTML ($oIE, $pB)
return
endfunc
Func make_html()
endfunc
Func _MSec()
Local $sMilliSeconds
Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort')
DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime))
$sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8))
$stSystemTime = 0
Return $sMilliSeconds
EndFunc
Func init_MARK()
$mark[1]="(1)"
$mark[2]="(2)"
$mark[3]="(3)"
$mark[4]="(4)"
$mark[5]="(5)"
$mark[6]="(6)"
$mark[7]="(7)"
$mark[8]="(8)"
$mark[9]="(9)"
; $mark[10]=" "
EndFunc |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|