问答题

[说明]
某文件管理系统的图片浏览器如图3-19所示。运行程序时,用户只要通过驱动器列表框、目录列表框和文件列表框,选择文本文件所在的驱动器、文件夹及相应的文件名后,在图像框中将显示出相应的文件图像。
在开发过程中,假设驱动器列表框名为drvFile,目录列表框名为 dirFile,文件列表框名为filFile,选择文件类型组合框名为cboFile,图像框名为imgShow。


图3-19 图片浏览器
[Visual Basic程序]
Private Sub Form_Load ()
imgShow.Stretch=True
cboFile.Addltem "位图文件(*.bmp)"
cboFile.Addltem "图标文件(*.ico)"
cboFile.Addltem "图元文件(*.wmf)"
cboFile.Addltem "JPEG文件(*.jpg)"
cboFile.Addltem "GIF文件(*.gif)"
cboFile.ListIndex = 0
(1)
End Sub
Private Sub drvFile_Change ()
(2)
End Sub
Private Sub dirFile_Change ()
(3)
End Sub
Private Sub cboFile_Click ()
(4)
Case 0
filFile. Pattern= "*.bmp"
Case 1
filFile. Pattern= "*.ico"
Case 2
filFile. Pattern= "*.wmf"
Case 3
filFile. Pattern= "*.jpg.
Case 4
filFile. Pattern= "*.gif"
End Select
End Sub
Private Sub filFile_Click()
If (5) Then
imgShow. Picture= LoadPieture(filFile. Path+ filFile.FileName)
Else
imgShow. Picture= LoadPicture( (6) + "\" + (7) )
End If
End Sub
1. [问题1]
请根据[说明]和图3-19的显示结果,从以下备选答案中为程序(1)~(7)空缺处选择正确的答案。
[备选答案]
A. filFile.path B. dirFile.Path=drvFile.Drive
C.Right(filFile.Path,1) = "\" D.filFile.Pattern ="*.bmp"
E.filFile.Path = dirFile.Path F.filFile.FileName
G.Select Case cboFile.ListIndex

【参考答案】

在Visual Basic应用程序中显示磁盘驱动器、目录和文件的有关信息(如设计资源管理器),除了使用对话框外,VB提供......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
热门 试题

问答题
[说明] C++语言本身不提供对数组下标越界的判断。为了解决这一问题,在以下[C++程序]中定义了相应的类模板,使得对于任意类型的二维数组,可以在访问数组元素的同时,对行下标和列下标进行越界判断,并给出相应的提示信息。 [C++程序] #include <iostream.h> template <class T> class Array; template <Class T> class ArrayBody friend (1) ; T* tpBody; int iRows,iColumns, iCurrentRow; ArrayBody(int IRsz, int iCsz) tpBody = (2) ; iRows = iRsz; iColumns = iCsz; iCurrentRow = -1; Public: T& operator[] (int j) bool row_error, column_error; row_error = column_error =false; try if (iCurrentRow < 0 || iCurrentRow >= iRows) row_error = true; if (j<0 || j>= iColumns) column_error = true; if (row_error == true || column_error == true) (3) ; catch(char) if (row_error == true) cerr << 行下标越界[ << iCurrentRow << ] ; if (column_error = true) cerr << 列下标越界[ << j << ] ; cout << n ; return tpBody[iCurrentRow * iColumns + j]; ~Arraygody()delete[]tpBody; ; template <class T> class Array ArrayBody<T> tBody; Public; ArrayBody<T> & operator[] (int i) (4) ; return tBody; Array(int iRsz, int iCsz) : (5) ; void main() Array<int> a1(10,20); Array<double> a2(3,5); int b1; double b2; b1 = a1[-5][10]; 有越界提示:行下标越界[-5] b1 = a1[10][15]; 有越界提示:行下标越界[10] b1 = a1[1][4]; 没有越界提示 b2 = a2[2][6]; 有越界提示:列下标越界[6] b2 = a2[10][20]; 有越界提示:行下标越界[10]列下标越界[20] b2 = a2[1][4]; 没有越界提示