|
呵呵,我终于做好了,请老师审批。谢谢!
代码如下:
一、分项回答:
Option Explicit
'1、按ESC键可以关闭窗体
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) '按下键时
If KeyCode = 27 Then
Unload Me
End If
End Sub
'2、按CTRL+Z 窗体的高度在原来的高度上+10(窗体的高度越来越高)
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) '按下键时
If KeyCode = 90 And Shift = 2 Then
UserForm1.Height = UserForm1.Height + 10
End If
End Sub
'3、按CTRL+X 窗体的高度在原来的基础上-10
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) '按下键时
If KeyCode = 88 And Shift = 2 Then
UserForm1.Height = UserForm1.Height - 10
End If
End Sub
'4、按ctrl+shift键的同时左键单击窗体,可以把窗体关闭
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) '鼠标左键按下
If Button = 1 And Shift = 3 Then
Unload Me
End If
End Sub
'二、1-4问题总回答实际运行
'1-3问题答案
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) '按下键时
If KeyCode = 27 Then
Unload Me
End If
If KeyCode = 88 And Shift = 2 Then
UserForm1.Height = UserForm1.Height - 10
End If
If KeyCode = 90 And Shift = 2 Then
UserForm1.Height = UserForm1.Height + 10
End If
End Sub
'4问题答案
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) '鼠标左键按下
If Button = 1 And Shift = 3 Then
Unload Me
End If
End Sub
第17讲作业JLF2003.zip
(8.81 KB, 下载次数: 2)
|
评分
-
查看全部评分
|