Results 1 to 6 of 6

Thread: How to resize Child form ?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2011
    Posts
    151

    How to resize Child form ?

    Hello all

    i have MDIForm and 3 Child Form i have code to make child form WindowState = vbMaximized with borderstyle = 0
    this work done but i have problem

    i have in my forms child 2 button

    Command1 to close form
    Command2 to hide farmmani.picture1 and picture2 to make child form like full screen


    here a problem

    if i load all or 2 child form and make a full screen and close any form the other forms automatic resizeing
    i need if i close any form the other form stay vbMaximized

    another thing

    i want if i in full screen and i tried to close form check if another child form loaded i need stay in full screen
    but if all child form is close except child form i tried to close show the picture1 and picture2 in farmmain


    source code in attachments

    wait for help

    thank you very much
    Attached Files Attached Files

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Apr 2011
    Posts
    151

    Re: How to resize Child form ?

    hello all

    any solutions ?

  3. #3
    Junior Member
    Join Date
    Jul 2014
    Posts
    16

    Re: How to resize Child form ?

    Change borderstyle to "sizeable"

    Name:  upload.jpg
Views: 403
Size:  23.2 KB

  4. #4
    gibra
    Guest

    Re: How to resize Child form ?

    Quote Originally Posted by putuoka View Post
    Change borderstyle to "sizeable"
    Picture still not visible, and other problems, too.
    Last edited by gibra; Jul 30th, 2014 at 04:17 AM.

  5. #5
    gibra
    Guest

    Re: How to resize Child form ?

    Quote Originally Posted by vbgedo View Post
    hello all
    any solutions ?
    First of all, comment the Resize events on all child forms :
    Code:
    Private Sub Form_Resize()
        'Me.WindowState = 2
    End Sub

    After this, add this routine in Module1.bas:
    Code:
    Public Sub UpdateForms(ByRef pForm As Form, ByVal pWindowState As FormWindowStateConstants)
        Dim f As Form
        For Each f In Forms
            If f.Name <> Farmmain.Name Then
                If f.Name <> pForm.Name Then
                    If f.MDIChild = True Then
                        f.WindowState = pWindowState
                    End If
                End If
            End If
        Next
        
        If Forms.Count = 2 Then '
            ' show pictures again
            Farmmain.Picture1.Visible = True
            Farmmain.Picture2.Visible = True
        End If
    End Sub

    Last, on Command1_Click event on all child forms add calling for UpdateForms:
    Code:
    Private Sub Command1_Click()
        UpdateForms Me, Me.WindowState
        Unload Me
    End Sub

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2011
    Posts
    151

    Re: How to resize Child form ?

    Quote Originally Posted by gibra View Post
    First of all, comment the Resize events on all child forms :
    Code:
    Private Sub Form_Resize()
        'Me.WindowState = 2
    End Sub

    After this, add this routine in Module1.bas:
    Code:
    Public Sub UpdateForms(ByRef pForm As Form, ByVal pWindowState As FormWindowStateConstants)
        Dim f As Form
        For Each f In Forms
            If f.Name <> Farmmain.Name Then
                If f.Name <> pForm.Name Then
                    If f.MDIChild = True Then
                        f.WindowState = pWindowState
                    End If
                End If
            End If
        Next
        
        If Forms.Count = 2 Then '
            ' show pictures again
            Farmmain.Picture1.Visible = True
            Farmmain.Picture2.Visible = True
        End If
    End Sub

    Last, on Command1_Click event on all child forms add calling for UpdateForms:
    Code:
    Private Sub Command1_Click()
        UpdateForms Me, Me.WindowState
        Unload Me
    End Sub

    Thank You very much

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