Results 1 to 3 of 3

Thread: Hard to explain...

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441
    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.
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    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

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Would prefer API

    User the timer is fine, but I'd hate to keep it running. Is there an API way?

    Anyone?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width