论文导读:这样便给通过VB6.0。并结合Office2003中的宏对象编写批改程序带来了可能。改进批改程序。评价操作题,例谈VB批改操作题的实现。
关键词:评价操作题,VB6.0,宏,批改程序
(一)、现状分析
面对大量的操作类试题,学生的当前练习状况怎样,教师不可能一个个打开进行查看或手动批改,这样不仅效率低,而且势必会大大增加工作量。改卷一直是困扰计算机教学的一大问题,因此让计算机自动批改并统计成绩,显得很迫切。论文格式,评价操作题。教师应把时间、精力都用在课堂教学和提高教学效果上,而不应该放在这无数次的打开、查看、关闭学生答案文件的操作上。
由于每年的考纲、考题相对固定,故题目结构也相对固定,这样便给通过VB6.0,并结合Office2003中的宏对象编写批改程序带来了可能。即使将来考查内容变了,我们也可以与时俱进,根据学生的练习实际,改进批改程序,以适应新的考题要求。
(二)、主要设计思路和部分程序段代码
下面就评判一份试卷,列出部分代码,其中的分值可以灵活更改,由于篇幅所限,以下对提示出错的信息和类似的程序段,以及一些变量的定义,就不在这里详细列出了。
假设在“考试试卷\9028”下,有文件夹[WJCZ]和考生答题文件,批改程序“阅卷”位于“\考试试卷”下。在“阅卷”按钮下有如下各题中的代码,其中在“通用”、“声明”中定义一系列公用变量
Option Explicit
Dim fso As New FileSystemObject
Dim Appwd, MyApp, MyWord , ex As Object
Dim score , score2 , score3 , score4 , score5 , score6As Single
Dim score7 , score8 , score9 , score10 ,score11, score12,score13 As Single
一、理论题(20分)。在前期的《巧用Access设计随机选择题》中实现了。
二、文件操作(10分)
(说明:要使用FSO,首先必须在工程中引用MicrosoftScripting Runtime)
本题的所有操作都在文件夹[WJCZ]中进行
(1)在creat\beset中建立名为bady的文件夹
Dim strFileName2As String
strFileName2 =App.Path & "\9028\wjcz"
Iffso.FolderExists(strFileName2 & "\creat\beset\bady") = True Then
score2 = score2 + 2 '每题2分,指定位置存在bady文件夹得分
Else
Print "文件操作:第1小题错了!"
EndIf
(2)将文件夹[WJCZ]中文件的文件的扩展名为.b的文件复制到repeat\copy文件夹中
Iffso.FileExists(strFileName2 & "\repeat\copy\base.b") = True Andfso.FileExists(strFileName2 & "\repeat\copy\navy.b") = True Andfso.FileExists(strFileName2 & "\base.b") = True Andfso.FileExists(strFileName2 & "\navy.b") Then
score2 = score2 + 2
EndIf '新旧位置都存在指定文件得分
(3)将文件夹speed中的quick.gif文件在文件夹[wjcz]中建立名为quick的快捷方式
Iffso.FileExists(strFileName2 & "\quick.lnk") = True Andfso.FileExists(strFileName2 & "\speed\quick.gif") = True Then
score2 =score2 + 2
EndIf
(4)将文件夹rename中的spring.txt文件改名为sprde.q
Iffso.FileExists(strFileName2 & "\rename\sprde.q") = True Andfso.FileExists(strFileName2 & "\rename\spring.txt") = False Then
score2 = score2 + 2
EndIf
(5)将文件夹time中文件VIRTUAL.TXT,移动到time\date中
Iffso.FileExists(strFileName2 & "\time\virtual.txt") = False Andfso.FileExists(strFileName2 & "\time\date\virtual.txt") = TrueThen
score2 =score2 + 2
EndIf '原位置不存在、新位置存在指定文件得分
Print"二、文件操作(10分):", score2; "分"
三、段落格式(8分)
(说明:首先必须在VB工程中引用“Microsoft word 11.0Object Library”)
Dim myDoc3 As Object
Dim Duan311 As String
Set appwd = CreateObject("Word.Application")
Set myDoc3 = Appwd.Documents.Open(App.Path & "\9028\段落A.doc")
⑴将标题"中国软件业全面反攻"设置为艺术字(注意:设置后,删除原标题文字及所在'行),艺术字式样:艺术字库中的第2行第4列,字体:隶书、32号,艺术字形状:朝
鲜鼓,阴影:阴影样式14,位于页面(4,2)厘米处,环绕方式:上下型。
Duan311 =myDoc3.Paragraphs(1).Range.Text
IfLeft(Duan311, 9) <> "中国软件业全面反攻"Then
score3 = score3 + 0.3‘若删除原标题,得0.3分
EndIf
IfSelection.ShapeRange.TextEffect.PresetShape = msoTextEffectShapeDeflate Then
score3 = score3 + 0.3 '艺术字形状:朝鲜鼓
EndIf
If Selection.InlineShapes(1).Shadow.Type = msoShadow14Then
score3 = score3 + 0.3'阴影样式14
EndIf
IfSelection.ShapeRange.Left = CentimetersToPoints(4) Then
score3 = score3 +0.3 '页面(4,2)
End If
IfSelection.ShapeRange.Top = CentimetersToPoints(2) Then
score3 = score3 + 0.3
EndIf
IfSelection.ShapeRange.WrapFormat.Type = wdWrapTopBottom Then
score3 = score3 +0.3 '上下环绕
EndIf
……
(2)正文第一段格式:字体为楷体_GB2312、小四,加单实线下划线,右对齐
If myDoc3.Paragraphs(1).Range.Font.Name = "楷体_GB2312"Then
score3 = score3 + 0.4
End If
If myDoc3.Paragraphs(1).Range.Font.Size = 12 Then
score3 = score3 + 0.4'字号,小四相当于12磅
End If
If myDoc3.Paragraphs(1).Range.Font.Underline = wdUnderlineSingle Then
score3 = score3 + 0.4'第一段单实线下划线
End If
IfmyDoc3.Paragraphs(1).Range.ParagraphFormat.Alignment = wdAlignParagraphRightThen
score3 =score3 + 0.4'第一段右对齐
End If
(3)正文第二段格式:字体为黑体、小四、蓝色、加着重号,字距加宽0.6磅
……
If myDoc3.Paragraphs(2).Range.Font.Color = wdColorBlue Then
score3 = score3 + 0.3'第二段颜色
End If
If myDoc3.Paragraphs(2).Range.Text.Font.EmphasisMark =wdEmphasisMarkUnderSolidCircle Then
score3 = score3 + 0.3'第二段着重号
End If
If myDoc3.Paragraphs(2).Range.Font.Spacing = 0.6 Then
score3 = score3 + 0.3 '第二段字距
End If
⑷正文第三段格式:首行缩进0.85厘米,1.2倍行距、段前间距8磅。
If myDoc3.Paragraphs(3).Range.ParagraphFormat.FirstLineIndent = 24.1 Then
score3 = score3 + 0.4 '首行缩进0.85厘米=24.1磅
End If
If myDoc3.Paragraphs(3).Range.ParagraphFormat.LineSpacing = 14.4Then
score3= score3 + 0.4 '行距1.2倍=14.4
End If
If myDoc3.Paragraphs(3).Range.ParagraphFormat.SpaceBefore = 8Then
score3 = score3 + 0.4 '段前间距8磅
End If
⑸正文第四段格式:段落加宽度为1.5磅的红色单实线方框、底纹填充色为淡蓝色。
'单实线方框、红色,设置时分以下方向
'左Borders(wdBorderLeft).LineStyle、右Borders(wdBorderRight).LineStyle、
'上Borders(wdBorderTop).LineStyle、下Borders(wdBorderBottom).LineStyle
IfmyDoc3.Paragraphs(4).Range.ParagraphFormat.Borders(wdBorderLeft).LineStyle =wdLineStyleSingle AndmyDoc3.Paragraphs(4).Range.ParagraphFormat.Borders(wdBorderLeft).LineWidth =wdLineWidth150pt And myDoc3.Paragraphs(4).Range.ParagraphFormat.Borders(wdBorderLeft).Color = wdColorRed Then
score3= score3 + 0.2
End If
……
IfmyDoc3.Paragraphs(4).Range.ParagraphFormat.Borders(wdBorderBottom).LineStyle =wdLineStyleSingle AndmyDoc3.Paragraphs(4).Range.ParagraphFormat.Borders(wdBorderBottom).LineWidth =wdLineWidth150pt And myDoc3.Paragraphs(4).Range.ParagraphFormat.Borders(wdBorderBottom).Color = wdColorRed Then
score3 = score3 + 0.2
EndIf
IfmyDoc3.Paragraphs(4).Range.ParagraphFormat.Borders.DistanceFromTop = 1 And myDoc3.Paragraphs(4).Range.ParagraphFormat.Borders.DistanceFromLeft= 4 And myDoc3.Paragraphs(4).Range.ParagraphFormat.Borders.DistanceFromBottom =1 And myDoc3.Paragraphs(4).Range.ParagraphFormat.Borders.DistanceFromRight = 4Then
score3 = score3 + 0.2
End If
'底纹淡蓝色
IfmyDoc3.Paragraphs(4).Range.Text.ParagraphFormat.Shading.BackgroundPatternColor= wdColorPaleBlue Then
1/4 1 2 3 4 下一页 尾页 |