-
I have a MDI app. I am trying to make it so that when a child is moved passed the limits of the MDI form like FORM1.top<MDIFORM.top, that FORM1's top changes to MDIFORM top. Does this make sense? I want the same to work for the left, left+width(right), and top+height(bottom) as well.
-
There is probably an API which will do this better and easier, but put a timer on the child form, set its interval to something like 100 and add this code:
Code:
Private Sub Timer1_Timer()
If Me.Top < 0 Then
Me.Top = 0
End If
If Me.Left < 0 Then
Me.Left = 0
End If
If Me.Left + Me.Width > MDIForm1.ScaleWidth Then
Me.Left = MDIForm1.ScaleWidth - Me.Width
End If
If Me.Top + Me.Height > MDIForm1.ScaleHeight Then
Me.Top = MDIForm1.ScaleHeight - Me.Height
End If
End Sub
-
Would prefer API
User the timer is fine, but I'd hate to keep it running. Is there an API way?
Anyone?