Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A Modal MDI Child Form...
Message
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB.NET 1.1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01078006
Message ID:
01078199
Views:
17
Here is my code on one of these types of forms I have:
Private Sub frmSearchTicket_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Move
        '************************************************************************
        ' Procedure/Function: frmSearchTicket_Move()
        ' Author: Ben Santiago
        ' Last Revision: 11/17/2005
        ' Description:
        '       Limit movement of search form to that of the main MDI form area.
        '************************************************************************

        '***************************************
        ' If Main MDI Form Minimized, Do Not Attempt Move
        '***************************************
        If objMainForm.WindowState = FormWindowState.Minimized Then
            Exit Sub
        End If

        '***************************************
        ' Check Top
        '        +44 = Used To Compensate For Title Bar & Menu
        '***************************************
        If Me.Top <= objMainForm.Top + 44 Then
            Me.Top = objMainForm.Top + 44
        End If

        '***************************************
        ' Check Left
        '        +7 = Used To Compensate For Left Border of MDI Parent
        '***************************************
        If Me.Left <= objMainForm.Left + 7 Then
            Me.Left = objMainForm.Left + 7
        End If

        '***************************************
        ' Check Right
        '        -7 = Used To Compensate For Right Border of MDI Parent
        '***************************************
        If Me.Left + Me.Width > (objMainForm.Left + objMainForm.Width) - 7 Then
            Me.Left = (objMainForm.Left + objMainForm.Width) - Me.Width - 7
        End If

        '***************************************
        ' Check Bottom
        '        -7 = Used To Compensate For Bottom Border of MDI Parent
        '***************************************
        If Me.Top + Me.Height > (objMainForm.Top + objMainForm.Height) - objMainForm.sbMainStatus.Height - 7 Then
            Me.Top = (objMainForm.Top + objMainForm.Height) - Me.Height - objMainForm.sbMainStatus.Height - 7
        End If

        '***************************************
        ' Record Distance From Top/Left of MDI Parent
        '    This Value Is Used For When The MDI
        '    Parent Is Moved. MDI Parent's Move Event Also
        '    Moves This Form To Continue "ChildForm" Appearance
        '***************************************
        If Not objMainForm.IsMoving Then
            DistanceFromMDIParentTop = Me.Top - objMainForm.Top
            DistanceFromMDIParentLeft = Me.Left - objMainForm.Left
        End If
    End Sub
________________________
Ben Santiago, MCP & A+
Programmer Analyst (SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS)
Eastern Suffolk BOCES - Student Data Services


Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
-Rich Cook
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform