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

📄 form1.frm

📁 vb.net开发的考试系统,界面美观
💻 FRM
📖 第 1 页 / 共 4 页
字号:
End Select
End Sub
Private Sub SAVE_KEY() '保存答案
Open App.Path & "\DATALIST\" & LoginName & "_answer.txt" For Append As #1
 For i = 1 To Check1.Count - 1
  If Check1(i).Value = 0 And Check2(i).Value = 0 And Check3(i).Value = 0 And Check4(i).Value = 0 Then
   Print #1, ""
  Else
   If Check1(i).Value = 1 Then
   Print #1, "A"
   End If
   If Check2(i).Value = 1 Then
   Print #1, "B"
   End If
   If Check3(i).Value = 1 Then
   Print #1, "C"
   End If
   If Check4(i).Value = 1 Then
   Print #1, "D"
   End If
  End If
 Next
Close #1
MsgBox "答案已保存"
End Sub
Private Sub SHOW_ST()
If Create_Boolean = True Then
Exit Sub
End If
Dim intFile As Integer
Dim strinput As String
Dim strst() As String
Dim strstimg() As String
Dim strtargetfile As String
strtargetfile = App.Path & "\datalist\" & LoginName & "_ask.txt"
intFile = FreeFile
Filesize = FileLen(strtargetfile)
             'If Dir(strtargetfile, vbNormal) <> "" Then
             '   Kill strtargetfile
             'End If
Open strtargetfile For Binary As #1
strinput = Space(Filesize)
Get #intFile, , strinput
strst = Split(strinput, vbCrLf)
XPPBR1.Max = Int((UBound(strst) - 1) / 5) '除5得到实际的选择题数,每执行一题即加1
XPPBR1.Min = 0
'通过以上读取出文本文件的内容,并进行导入程序
'ubound(strst)-1 是获取strst数组的总数并减1,获得分隔后文本的行数
For i = 0 To UBound(strst) - 1 Step 5
Load Label1(Label1.UBound + 1)
If imgxj = False Then
Label1(Label1.Count - 1).Top = Check4(Check4.Count - 1).Top + Check4(Check4.Count - 1).Height + 300
Else
Label1(Label1.Count - 1).Top = Image1(Image1.Count - 1).Top + Image1(Image1.Count - 1).Height + 300
End If
strstimg = Split(strst(i), "@")
Label1(Label1.Count - 1).Caption = Mid(strstimg(0), 1, Len(strstimg(0)) - 1)
If strstimg(1) <> "" Then '此处可能会有错误'UBound(strstimg) > 1 Then
Load Image1(Image1.UBound + 1)
Image1(Image1.Count - 1).Picture = LoadPicture(App.Path & Mid(strstimg(1), 5, Len(strstimg(1)) - 4))
Image1(Image1.Count - 1).Top = Label1(Label1.Count - 1).Top + Label1(Label1.Count - 1).Height + 100
'Label1(Label1.Count - 1).Top = Image1(Image1.Count - 1).Top + (Image1(Image1.Count - 1).Height - Label1(Label1.Count - 1).Height) / 2
Image1(Image1.Count - 1).Left = Label1(Label1.Count - 1).Left
Image1(Image1.Count - 1).Visible = True
imgxj = True
Else
imgxj = False
End If
Label1(Label1.Count - 1).Visible = True

Load Check1(Check1.UBound + 1)
If imgxj = False Then
Check1(Check1.Count - 1).Top = Label1(Label1.Count - 1).Top + Label1(Label1.Count - 1).Height + 100
Else
Check1(Check1.Count - 1).Top = Image1(Image1.Count - 1).Top + Image1(Image1.Count - 1).Height + 100
End If
If Mid(strst(i + 1), 4, 4) = "BMP|" Then
Load Image1(Image1.UBound + 1)
Image1(Image1.Count - 1).Picture = LoadPicture(App.Path & Mid(strst(i + 1), 8, Len(strst(i + 1)) - 7))
Check1(Check1.Count - 1).Caption = Mid(strst(i + 1), 1, 3)
Check1(Check1.Count - 1).Width = 615
Image1(Image1.Count - 1).Left = Check1(Check1.Count - 1).Left + Check1(Check1.Count - 1).Width + 100
Image1(Image1.Count - 1).Top = Check1(Check1.Count - 1).Top + Check1(Check1.Count - 1).Height + 100
Check1(Check1.Count - 1).Top = Image1(Image1.Count - 1).Top + (Image1(Image1.Count - 1).Height - Check1(Check1.Count - 1).Height) / 2
Image1(Image1.Count - 1).Visible = True
Else
Check1(Check1.Count - 1).Caption = strst(i + 1)
imgxj = False
End If
Check1(Check1.Count - 1).Visible = True
'*******************************************
Load Check2(Check2.UBound + 1)
If imgxj = False Then
Check2(Check2.Count - 1).Top = Check1(Check1.Count - 1).Top + Check1(Check1.Count - 1).Height + 100
Else
Check2(Check2.Count - 1).Top = Image1(Image1.Count - 1).Top + Image1(Image1.Count - 1).Height + 100
End If
If Mid(strst(i + 2), 4, 4) = "BMP|" Then
Load Image1(Image1.UBound + 1)
Image1(Image1.Count - 1).Picture = LoadPicture(App.Path & Mid(strst(i + 2), 8, Len(strst(i + 2)) - 7))
Check2(Check2.Count - 1).Caption = Mid(strst(i + 2), 1, 3)
Check2(Check2.Count - 1).Width = 615
Image1(Image1.Count - 1).Left = Check2(Check2.Count - 1).Left + Check2(Check2.Count - 1).Width + 100
Image1(Image1.Count - 1).Top = Check2(Check2.Count - 1).Top + Check2(Check2.Count - 1).Height + 100
Check2(Check2.Count - 1).Top = Image1(Image1.Count - 1).Top + (Image1(Image1.Count - 1).Height - Check2(Check2.Count - 1).Height) / 2
Image1(Image1.Count - 1).Visible = True
imgxj = True
Else
Check2(Check2.Count - 1).Caption = strst(i + 2)
imgxj = False
End If
Check2(Check2.Count - 1).Visible = True
'*********************************************
Load Check3(Check3.UBound + 1)
If imgxj = False Then
Check3(Check3.Count - 1).Top = Check2(Check2.Count - 1).Top + Check2(Check2.Count - 1).Height + 100
Else
Check3(Check3.Count - 1).Top = Image1(Image1.Count - 1).Top + Image1(Image1.Count - 1).Height + 100
End If
If Mid(strst(i + 3), 4, 4) = "BMP|" Then
Load Image1(Image1.UBound + 1)
Image1(Image1.Count - 1).Picture = LoadPicture(App.Path & Mid(strst(i + 3), 8, Len(strst(i + 3)) - 7))
Check3(Check3.Count - 1).Caption = Mid(strst(i + 3), 1, 3)
Check3(Check3.Count - 1).Width = 615
Image1(Image1.Count - 1).Left = Check3(Check3.Count - 1).Left + Check3(Check3.Count - 1).Width + 100
Image1(Image1.Count - 1).Top = Check3(Check3.Count - 1).Top + Check3(Check3.Count - 1).Height + 100
Check3(Check3.Count - 1).Top = Image1(Image1.Count - 1).Top + (Image1(Image1.Count - 1).Height - Check3(Check3.Count - 1).Height) / 2
Image1(Image1.Count - 1).Visible = True
imgxj = True
Else
Check3(Check3.Count - 1).Caption = strst(i + 3)
imgxj = False
End If
Check3(Check3.Count - 1).Visible = True
'*******************************************
Load Check4(Check4.UBound + 1)
If imgxj = False Then
Check4(Check4.Count - 1).Top = Check3(Check3.Count - 1).Top + Check3(Check3.Count - 1).Height + 100
Else
Check4(Check4.Count - 1).Top = Image1(Image1.Count - 1).Top + Image1(Image1.Count - 1).Height + 100
End If

If Mid(strst(i + 4), 4, 4) = "BMP|" Then
Load Image1(Image1.UBound + 1)
Image1(Image1.Count - 1).Picture = LoadPicture(App.Path & Mid(strst(i + 4), 8, Len(strst(i + 4)) - 7))
Check4(Check4.Count - 1).Caption = Mid(strst(i + 4), 1, 3)
Check4(Check4.Count - 1).Width = 615
Image1(Image1.Count - 1).Left = Check4(Check4.Count - 1).Left + Check4(Check4.Count - 1).Width + 100
Image1(Image1.Count - 1).Top = Check4(Check4.Count - 1).Top + Check4(Check4.Count - 1).Height + 100
Check4(Check4.Count - 1).Top = Image1(Image1.Count - 1).Top + (Image1(Image1.Count - 1).Height - Check4(Check4.Count - 1).Height) / 2
Image1(Image1.Count - 1).Visible = True
imgxj = True
Else
Check4(Check4.Count - 1).Caption = strst(i + 4)
imgxj = False
End If
If strst(i + 4) <> "" Then
Check4(Check4.Count - 1).Visible = True
End If
XPPBR1.Value = XPPBR1.Value + 1
Next
Close #1
If imgxj = False Then
PictureQG1.Height = Check4(Check4.Count - 1).Top + Check4(Check4.Count - 1).Height + 500
Else
PictureQG1.Height = Image1(Image1.Count - 1).Top + Image1(Image1.Count - 1).Height + 500
End If
'以下语句保证vscroll1在拉动中,同步的picture不会出界
For j = 1 To 1000
 If ((PictureQG1.Height - PictureBG1.ScaleHeight) Mod j) = 0 And (PictureQG1.Height - PictureBG1.ScaleHeight) / j < 32767 Then
 vscmod = j
 Exit For
 End If
Next
VScroll1.Max = (PictureQG1.Height - PictureBG1.ScaleHeight) / vscmod
Create_Boolean = True
Labeltime.Caption = KS_TIME
Timer2.Enabled = True
End Sub

Private Sub Label_showfont()
' 设置“取消”为 True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' 设置 Flags 属性
CommonDialog1.Flags = cdlCFEffects Or cdlCFBoth
' 显示“字体”对话框
CommonDialog1.ShowFont
For i = 0 To Label1.Count - 1
Label1(i).Font.name = CommonDialog1.FontName
Label1(i).Font.Size = CommonDialog1.FontSize
Label1(i).Font.Bold = CommonDialog1.FontBold
Label1(i).Font.Italic = CommonDialog1.FontItalic
Label1(i).Font.Underline = CommonDialog1.FontUnderline
Label1(i).FontStrikethru = CommonDialog1.FontStrikethru
Label1(i).ForeColor = CommonDialog1.Color
Label1(i).Caption = Label1(i).Caption
If Label1(i).Left + Label1(i).Width >= PictureQG1.ScaleWidth Then
Label1(i).Width = Label1(i).Width * 2
End If
Next
For i = 0 To Check1.Count - 1
Check1(i).Font.name = CommonDialog1.FontName
Check1(i).Font.Size = CommonDialog1.FontSize
Check1(i).Font.Bold = CommonDialog1.FontBold
Check1(i).Font.Italic = CommonDialog1.FontItalic
Check1(i).Font.Underline = CommonDialog1.FontUnderline
Check1(i).ForeColor = CommonDialog1.Color
Check2(i).Font.name = CommonDialog1.FontName
Check2(i).Font.Size = CommonDialog1.FontSize
Check2(i).Font.Bold = CommonDialog1.FontBold
Check2(i).Font.Italic = CommonDialog1.FontItalic
Check2(i).Font.Underline = CommonDialog1.FontUnderline
Check2(i).ForeColor = CommonDialog1.Color
Check3(i).Font.name = CommonDialog1.FontName
Check3(i).Font.Size = CommonDialog1.FontSize
Check3(i).Font.Bold = CommonDialog1.FontBold
Check3(i).Font.Italic = CommonDialog1.FontItalic
Check3(i).Font.Underline = CommonDialog1.FontUnderline
Check3(i).ForeColor = CommonDialog1.Color
Check4(i).Font.name = CommonDialog1.FontName
Check4(i).Font.Size = CommonDialog1.FontSize
Check4(i).Font.Bold = CommonDialog1.FontBold
Check4(i).Font.Italic = CommonDialog1.FontItalic
Check4(i).Font.Underline = CommonDialog1.FontUnderline
Check4(i).ForeColor = CommonDialog1.Color

Next
Exit Sub
ErrHandler:
' 用户按了“取消”按钮
Exit Sub
End Sub

Private Sub Timer1_Timer() '设此时钟是用以保证文件传输中的空隙,否则将无法正确传送
LabelCZ.Caption = "进入接收文件状态"
sckClient.SendData "OPENPLAY|" & Filename & vbCrLf
Timer1.Enabled = False
End Sub

Private Sub Timer2_Timer()
Labeltime = Labeltime - 1
If Int(Labeltime) <= 0 Then
 Labeltime = "0"
 Timer2.Enabled = False
 LabelCZ.Caption = "考试已经结束,正在提交答案给服务器端"
 SAVE_KEY '保存答案
 Filename = App.Path & "\DATALIST\" & LoginName & "_answer.txt"
 sckClient.SendData "FILENAME|" & Mid(Filename, InStrRev(Filename, "\") + 1) & vbCrLf
 Filesize = FileLen(Filename)
 sckClient.SendData "FILESIZE|" & Filesize & vbCrLf
End If
End Sub

Private Sub VScroll1_Change()
Dim vscnumber As Double '一定要引用出vscroll1.value的值,否则会出现溢出错误
vscnumber = -VScroll1.Value
PictureQG1.Top = vscnumber * vscmod
End Sub

Private Sub VScroll1_Scroll()
Dim vscnumber As Double
vscnumber = -VScroll1.Value
PictureQG1.Top = vscnumber * vscmod
End Sub


Private Sub Form_Load()
Client_load
sckClient.RemoteHost = ConnentIP 'ServerIP '注释:可以更改为你运行服务器的主机名
sckClient.RemotePort = 8888
firsttime = True
'XPPBR1.Visible = False '进度条不显示
Picture1.BackColor = RGB(77, 77, 77)
Picture2.BackColor = RGB(77, 77, 77)
Picture3.BackColor = RGB(101, 101, 101)
Picture4.BackColor = RGB(101, 101, 101)
Set ACPRibbon1.Picture = ImageTOP.Picture

'# Show Caption of Form
ACPRibbon1.Caption = Me.Caption
ACPRibbon1.AddTopButton "1", "手动保存答案", Imagemenu1.Picture
'# Add Tabs ---   ID - Caption
ACPRibbon1.AddTab "1", "试题生成"
ACPRibbon1.AddTab "2", "试题设定"
ACPRibbon1.AddTab "3", "提交答案"
ACPRibbon1.AddTab "4", "系统设定"
ACPRibbon1.AddTab "5", "退出系统"

ACPRibbon1.AddCat "1", "1", "请求生成试题", False
ACPRibbon1.AddCat "2", "1", "开始考试", False
ACPRibbon1.AddCat "3", "2", "字体与大小设定", False
ACPRibbon1.AddCat "4", "3", "提交答案", False
ACPRibbon1.AddCat "5", "4", "机器ID", False
ACPRibbon1.AddCat "6", "4", "服务器IP", False
ACPRibbon1.AddCat "7", "5", "退出系统", False

ACPRibbon1.AddButton "1", "1", "                                ", ImageTAB1.Picture, False, "发服务器端发送生成试题的请求"
ACPRibbon1.AddButton "2", "2", "                           ", ImageTAB1.Picture, False, "开始读取试题"
ACPRibbon1.AddButton "3", "3", "                                ", ImageTAB1.Picture, False, "设定字体与文字大小以适应您的要求"
ACPRibbon1.AddButton "4", "4", "                                ", ImageTAB1.Picture, False, "将试题答案提交到服务器以获得本次考试的成绩"

⌨️ 快捷键说明

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