![]() |
|
(31) 设在窗体上有一个文本框,然后编写如下的事件过程:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Const Alt=4
Const Key_F2= &H71
altdown%=(Shift And Alt) > 0
f2down%=(KeyCode=Key_F2)
If altdown% And f2down% Then
Text1.Text= "abl"
End If
End Sub
程序运行后,清除文本框中原有内容,如果按Shift+F2键,则在文本框中显示的是
A.Alt+F2
B.abl
C.随机出几个数
D.不发生变化
正确答案: D
(32) 设已经在菜单编辑器中设计了窗体的快捷菜单,其顶级菜单为Bt,取消其"可见"属性,运行时,在以下事件过程中,可以使快捷菜单相应鼠标右键菜单的是
A.Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If Button=2 Then PopupMenu Bt, 2
End Sub
B.Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
PopupMenu Bt
End Sub
C.Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
PopupMenu Bt,0
End Sub
D.Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If (Button=vbLeftButton) Or (Button=vbRightButton) Then PopupMenu Bt
End Sub
正确答案: A
(33) 在窗体上画一个通用对话框,其Name属性为Cont,再画一个命令按钮,Name属性为Command1,然后编写如下事件过程:
Private Sub Command1_Click()
Cont.FileName= ""
Cont.Flags=vbOFNFileMustExist
Cont.Filter= "All Files|*.*"
Cont.FilterIndex=3
Cont.DialogTitle= "Open File"
Co nt.Action=1
If Cont.FileName= "" Then
MsgBox "No file selected"
Else
Open Cont.FileName For Input As #1
Do While Not EOF(1)
Input #1, b$
Print b$
Loop
End If
End Sub
以下各选项,对上述事件过程描述错误的是
A.该事件过程用来建立一个Open对话框,可以在这个对话框中选择要打开的文件
B.选择后单击"打开"按钮,所选择的文件名即作为对话框的FileName属性值
C.Open对话框不仅仅用来选择一个文件,还可以打开、显示文件
D.过程中的"Cont.Action=1"用来建立Open对话框,它与Cont.ShowOpen等价
正确答案: C
(34) 已知使用Show方法的格式为:[窗体名称].Show [模式],如果要使窗体是"模态型"窗体,则"模式"值为
A.True
B.0
C.1
D.False
正确答案: C
(35) 下面叙述不正确的是
A.对顺序文件中的数据操作只能按一定的顺序操作
B.顺序文件结构简单
C.能同时对顺序文件进行读写操作
D.顺序文件中只能知道第一个记录的位置
正确答案: C