哪个强人给一段可以让VB程序的窗口移动,碰到边缘反弹的代码

RT
2024-11-19 13:13:13
推荐回答(1个)
回答1:

简单示例,你需要再扩展

Option Explicit
Dim bM As Boolean

Private Sub Command1_Click()
bM = Not bM
Call MoveFrm
End Sub

Sub MoveFrm()
Dim iM As Long
iM = 100
Do While bM
With Me
.Left = .Left + iM
If .Left <= 0 Or (.Left + .Width) > Screen.Width Then iM = iM * -1
End With
DoEvents
Loop
End Sub