一个很好的鼠标滚轮放大缩小窗体,控件也会改变位置
Dim s As LongDim y As Long
Private Sub combo1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim w As Long
w = s * (Width / Height)
If KeyCode = 38 Then
If Height <= Screen.Height - s And Width <= Screen.Width - w Then
Height = Height + s
Width = Width + w
End If
ElseIf KeyCode = 40 Then
If Height > s And Width > w + y Then
Height = Height - s
Width = Width - w
End If
End If
End Sub
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Load()
s = 300
y = 2000
Picture1.TabStop = False
With Combo1
.Left = -.Width - 100
End With
End Sub
Private Sub Form_Resize()
With Picture1
.Top = 0
.Left = 0
.Width = Width
.Height = heigth
End With
With Me
.Left = (Screen.Width - Width) / 2
.Top = (Screen.Height - Height) / 2
Command1.Top = Form1.ScaleHeight - 800
Command1.Left = Form1.ScaleWidth - 1600
End With
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single)
Combo1.SetFocus
End Sub
放大缩小窗体.rar
(5.61 KB)