3.是非題
黑色:程式碼 藍色:說明
Dim sno As Integer
宣告 sno 為整數變數,起始值是0,這是用來確認學生作答流程的變數
早期瀏覽器以 IE 為主,而當時的 IE 是可以執行 PowerPoint 的,結果有些小朋友的投影片就沒按順序亂跳,得到的結果也就沒有參考價值。
Private Sub CommandButton1_Click() 第一個按鈕 O 的程式
If tea = 1 Then 如果 tea = 1,取得教師權限
CommandButton1.Caption = Slide2.tru.Caption
CommandButton2.Caption = Slide2.fal.Caption
從試卷設定頁取得按鈕內的符號(OX 或 True False)
If Slide2.modify <> True Then Label1 = itmno 試卷設定頁沒有勾 □修改答案 則寫入題號
If anset = 1 Then 如果試卷設定頁按下 設定答案 則
ScrollBar1.Value = 1 設定ScrollBar1(隱藏的捲軸,用來儲存答案)的值為 1
MsgBox seta & CommandButton1.Caption 訊息盒顯示:設定答案為按鈕1的符號
Else 否則(沒有要設定答案)
End If 離開
nex 到下一頁
CommandButton1.BackColor = &H8000000F 設定二個按鈕的顏色
CommandButton2.BackColor = &H8000000F
Label1.BackColor = &HFFFFFF 題號背景設為白色
Else 否則(沒有教師權限,也就是學生按的)
CommandButton1.BackColor = &HC0C0FF 設定第一個按鈕的顏色,表示學生按了這個按鈕
CommandButton2.BackColor = &H8000000F 設定第二個按鈕的顏色為預設值
If Label1 <> itmno Then 如果題號不等於 itmno 則
MsgBox eropstn 訊息盒顯示:操作程序錯誤
fist 跳到首頁
Exit Sub 離開程式
End If
If sno = flow Then 如果 sno = flow 則(sno 目前為0,flow則在首頁已經 +1,所以不應該相等)
MsgBox eropstn 訊息盒顯示:操作程序錯誤
fist 跳到首頁
Exit Sub 離開程式
Else
If ScrollBar1.Value = 1 Then 如果 ScrollBar1.Value = 1 則
rt = rt + 1 答對數+1
Label1.BackColor = &HFFFFFF 題號背景設為白色
MsgBox rtstn 訊息盒顯示:答對時的回饋
sno = flow 將 flow 寫入 sno
nex 下一頁
Else 否則
er = er + 1 答錯數+1
erstring = erstring & " " & itmno 題號寫入 erstring (記錄答錯的題號)
Label1.BackColor = &HC0C0FF 題號背景顏色變紅色
MsgBox erstn 訊息盒顯示:答錯時的回饋
sno = flow
nex
End If
End If
End If
itmno = itmno + 1 題目計數器+1
Label2 = "E-test6"
Label2.Width = 78
Label2.Top = 5
Label2.Left = 642
Label2.Height = 32
Label2:右上角的版本標籤,可以自行修改。如果要刪掉,這段程式碼也要刪掉
End Sub 結束程式
Private Sub CommandButton2_Click() 第2個按鈕 X 的程式,以下略
If tea = 1 Then
CommandButton1.Caption = Slide2.tru.Caption
CommandButton2.Caption = Slide2.fal.Caption
If Slide2.modify <> True Then Label1 = itmno
If anset = 1 Then
ScrollBar1.Value = 2
MsgBox seta & CommandButton2.Caption
Else
End If
nex
CommandButton1.BackColor = &H8000000F
CommandButton2.BackColor = &H8000000F
Label1.BackColor = &HFFFFFF
Else
CommandButton1.BackColor = &H8000000F
CommandButton2.BackColor = &HC0C0FF
If Label1 <> itmno Then
MsgBox eropstn
fist
Exit Sub
End If
If sno = flow Then
MsgBox eropstn
fist
Exit Sub
Else
If ScrollBar1.Value = 2 Then
rt = rt + 1
Label1.BackColor = &HFFFFFF
MsgBox rtstn
sno = flow
nex
Else
er = er + 1
erstring = erstring & " " & itmno
Label1.BackColor = &HC0C0FF
MsgBox erstn
sno = flow
nex
End If
End If
End If
itmno = itmno + 1
Label2 = "E-test6"
Label2.Width = 78
Label2.Top = 5
Label2.Left = 642
Label2.Height = 32
End Sub