我不知道呀
发表于 2012-5-31 22:09
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
ElseIf KeyCode = 88 And Shift = 2 Then
UserForm1.Height = UserForm1.Height - 10
End If
End Sub
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
冠军欧洲2010
发表于 2012-5-31 23:03
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim X
X = Me.Height
If KeyCode = 27 Then
Unload Me
ElseIf KeyCode = 90 And Shift = 2 Then
Me.Height = X + 10
ElseIf KeyCode = 88 And Shift = 2 Then
Me.Height = X - 10
End If
' MsgBox KeyCode
End Sub
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
冠军欧洲2010
发表于 2012-5-31 23:06
w2001pf 发表于 2012-5-30 14:29 static/image/common/back.gif
作业在哪里啊?
http://www.excelpx.com/thread-245811-1-1.html
这是作业的链接。
ls
发表于 2012-6-1 01:17
'插入一个空白窗体,
'Print 要求:
'1 按ESC键可以关闭窗体
'2按CTRL+Z 窗体的高度在原来的高度上+10(窗体的高度越来越高)
'3按CTRL+X 窗体的高度在原来的基础上-10
'4按ctrl+shift键的同时左键单击窗体,可以把窗体关闭
'
'注: 上传答案时
'1 测试正确无误
'2 代码一定要贴出来可以不传附件
'3 在班里的指定作业贴处上交作业
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
'MsgBox KeyCode
If KeyCode = 27 Then Unload Me
If KeyCode = 90 And Shift = 2 Then Me.Height = Me.Height + 10
If KeyCode = 88 And Shift = 2 Then Me.Height = Me.Height - 10
End Sub
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 Sub
dsjohn
发表于 2012-6-1 20:59
1、按ESC键可以关闭窗体
Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 27 Then Unload Me
End Sub
2、按CTRL+Z 窗体的高度在原来的高度上+10(窗体的高度越来越高)
3、按CTRL+X 窗体的高度在原来的基础上-10
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Shift = 2 And KeyCode = 90 Then
Height = Height + 10
ElseIf Shift = 2 And KeyCode = 88 Then
Height = 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 Shift = 3 And Button = 1 Then Unload Me
End Sub
水上漂123
发表于 2012-6-2 08:18
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim x As Single
x = Me.Height
If KeyCode = 90 And Shift = 2 Then
Me.Height = x + 10
ElseIf KeyCode = 88 And Shift = 2 Then
Me.Height = x - 10
ElseIf KeyCode = 27 Then
Unload Me
End If
End Sub
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
chenzhi_juan
发表于 2012-6-2 08:36
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then
Me.Hide
Else
If KeyCode = vbKeyZ And Shift = 2 Then
Me.Height = Me.Height + 10
Else
If KeyCode = vbKeyX And Shift = 2 Then
Me.Height = Me.Height - 10
End If
End If
End If
End Sub
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
Me.Hide
End If
End Sub
[\:code]
H19:chenzhi_juan
1982zyh
发表于 2012-6-2 17:05
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then
Unload UserForm1
End If
If KeyCode = 90 And Shift = 2 Then
UserForm1.Height = UserForm1.Height + 10
ElseIf KeyCode = 88 And Shift = 2 Then
UserForm1.Height = UserForm1.Height - 10
End If
End Sub
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 UserForm1
End If
End Sub
sunjing-zxl
发表于 2012-6-2 17:58
E学委:sunjing-zxl 交作业
代码中的"sunjing"是窗体名字
'esc=27,z=90,x=88
'shift 是按下shift(值为1) or ctrl(值为2)或alt(值为3)
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 27 Then
Unload sunjing
ElseIf Shift = 2 Then
If KeyCode = 90 Then
sunjing.Height = sunjing.Height + 10
ElseIf KeyCode = 88 Then
sunjing.Height = sunjing.Height - 10
End If
End If
End Sub
' button 值按左键返回1,按右键返回2,按中键返回4
' shift 按Shift返回1,按ctrl返回2,shift+ctrl返回3,Atl按回4
' X,Y 是指点击的位置
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 sunjing
End If
End Sub
libenwen2011
发表于 2012-6-2 18:33
16组:libenwen2011 (UID: 514207)
Private Sub UserForm_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If KeyCode = 27 Then 'ESC键关闭窗体
Unload Me
End If
If KeyCode = 90 Then 'ctrl+Z窗体高度+10
X = Me.Height
Me.Height = X + 10
End If
If KeyCode = 88 Then 'ctrl+x窗体高度-10
X = Me.Height
Me.Height = X - 10
End If
End Sub
'按下shift+ctrl组合键并且按鼠标左键,关闭窗体
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