问题 问答题

完成下列问题:

在名称为Form1的窗体上画一个名称为Command1的命令按钮,标题为“打开文件”,再画一个名称为CD1的通用对话框。程序运行后,如果单击命令按钮,则弹出打开文件对话框。请按下列要求设置属性和编写代码:
①设置适当的属性,使用话框的标题为“打开文件”。
②设置适当的属性,使对话框的“文件类型”下拉列表框中有2个选项:“文本文件”、“所有文件”(如图1所示),默认的类型是“所有文件”。


③编写命令按钮的事件过程,使得单击按钮可以弹出打开文件对话框。
要求:程序中不得使用变量,事件过程中只能写一条语句。
注意:存盘时必须存放在考生文件夹下,工程文件名为sjt1.vbp,窗体文件名为sjt1.frm。

答案

参考答案:[操作步骤]
第1步:新建一个标准EXE工程。
第2步:添加命令按钮。在窗体上有一个命令按钮控件,设置其Caption属性为“打开文件”。
第3步:添加通用对话框。选择“工程”菜单下的“部件”子菜单,在弹出的“部件”对话框中的Microsoft Common Dialog Control 6.0前的复选框中打上勾号,再单击“确定”按钮。此时,在工具箱的右下角会显示出通用对话框控件图标[*],选择该图标在窗体上画一个通用对话框控件。
第4步:设置通用对话框的属性。设置通用对话框的名称属性为CD1,设置DialogTitle属性为“打开文件”,设置Filter属性为“文本文件|*.txt|所有文件|*.*”,设置FilterIndex属性为2,如图1所示。
[*]
第5步:编写代码。双击窗体上的命令按钮,编写命令按钮的事件过程代码如下:
Private Sub Command1_Click()
CD1.ShowOpen
End Sub
第6步:调试并运行程序,并按题目要求保存工程。

解析: 本题需要用到外部控件通用对话框Microsoft Common Dialog Control,通用对话框的标题由DialogTitle属性控制;文件类型的过滤方式由Filter属性控制,当有多种过滤方式时,可用FilterIndex属性指定默认的过滤方式。

解答题
完形填空
完形填空
     He met her at a party.She was outstanding; many boys were after her, but nobody paid any  1   to
him.After the party, he invited her for coffee.She was surprised.In order not to_2  rude, she went along.
        3   they sat in a nice coffee shop, he was too  4   to say anything.Suddenly, he asked the waiter,
"Could you please  5   me some salt?I'd like to put it in my coffee."
     The girl stared at him.He turned red, but when the salt came, he put it in his coffee and drank.  6  ,
she asked, "Why salt with coffee?" he  7  , "When I was a little boy, I lived near the sea.I liked playing
on the sea...I could  8   its taste salty, like salty coffee.Now every time I drink it, I think of my  9   and
my hometown.I miss it and my parents, who are still there."
     She was deeply  10  . A man who can  11   that he's homesick must love his home and  12   about
his family.He must be  13  .
     She talked too, about her faraway hometown, her childhood and her  14   .That was the start to their
love story.
    They continued to date each other.She found that he met all her  15  .He was kind, warm, and
careful.  16    to think she would have missed the  17    if not for the salty coffee.
     So they married and lived happily together.Every time she made coffee for him, she put in some salt,
the 18   he liked it.
     After 40 years, he  19   away and left her a letter which said, "My dearest, please forgive my lifelong
lie.Remember the first time we dated?I was so nervous I asked for salt instead of sugar.If I could live a
second time, I hope we can be together again,  20   it means that I have to drink salty coffee for the rest
of my life."
( )1. A. money      
( )2. A. show      
( )3. A. As        
( )4. A. eager      
( )5. A. lift      
( )6. A. Mysterious
( )7. A. explained  
( )8. A. taste      
( )9. A. boat      
( )10. A. touched  
( )11. A. afford    
( )12. A. mind      
( )13. A. smart    
( )14. A. family    
( )15. A. friends  
( )16. A. And      
( )17. A. sight    
( )18. A. method    
( )19. A. moved    
( )20. A. as if    
B. attention    
B. look        
B. Because      
B. proud        
B. take        
B. Moved        
B. argued      
B. feel        
B. friend      
B. hurt        
B. realize      
B. care        
B. intelligent  
B. school      
B. requirements
B. When        
B. train        
B. style        
B. passed      
B. now that    
C. visit      
C. seem      
C. Since      
C. nervous    
C. carry      
C. Curious    
C. stated    
C. smell      
C. playmate  
C. pressed    
C. recognize  
C. know      
C. responsible
C. relatives  
C. needs      
C. Or        
C. catch      
C. manner    
C. died      
C. even if    
D. respect        
D. appear        
D. Though        
D. anxious        
D. bring          
D. Excited        
D. claimed        
D. sense          
D. childhood      
D. interested    
D. admit          
D. attend        
D. flexible      
D. house          
D. standards      
D. But            
D. home          
D. way            
D. walked        
D. so that