Align Center

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pentahari
    New Member
    • Dec 2007
    • 60

    Align Center

    How to open the MDI Parent form in center to the MDI form.
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    #2
    In your version is there a property called:

    "StartPossition " on the form?

    if so choose centerparent

    Comment

    • pentahari
      New Member
      • Dec 2007
      • 60

      #3
      Originally posted by jamesd0142
      In your version is there a property called:

      "StartPossition " on the form?

      if so choose centerparent
      I am using Visual basic 6.0

      Comment

      • shuvo2k6
        New Member
        • Jan 2008
        • 68

        #4
        Originally posted by pentahari
        How to open the MDI Parent form in center to the MDI form.
        u can try by changing this Property

        "StartUpPositio n"

        i am not sure. OK, try.

        Comment

        • pentahari
          New Member
          • Dec 2007
          • 60

          #5
          Originally posted by shuvo2k6
          u can try by changing this Property

          "StartUpPositio n"

          i am not sure. OK, try.
          When I try to Change MDI Child Form's StartUpPosition Property to 1-Center Owner (or) 2-Center Screen (or) 3-Windows Default then "Invalid Property Value" Error Msg appear.

          Thanks Advance

          Comment

          • jamesd0142
            Contributor
            • Sep 2007
            • 471

            #6
            Im not sure in vb6, but why not make your own Code?

            try somthing like

            MDIChildForm.To p = mdiparent.Heigh t - mdiparent.Heigh t / 2
            MDIChildForm.Le ft = mdiparent.Width - mdiparent.Width / 2

            you can see where its goin..?

            Also in case they are different in vb6;

            Top = the position of the top of the mdi child form in the mdi parent form
            Left = the position of the left of the mdi child form in the mdi parent form

            Comment

            • shuvo2k6
              New Member
              • Jan 2008
              • 68

              #7
              Originally posted by pentahari
              When I try to Change MDI Child Form's StartUpPosition Property to 1-Center Owner (or) 2-Center Screen (or) 3-Windows Default then "Invalid Property Value" Error Msg appear.

              Thanks Advance
              chld.Top = (MDIForm.Height - chld.Height) / 2
              chld.Left = (MDIForm.Width - chld.Width) / 2

              Comment

              • pentahari
                New Member
                • Dec 2007
                • 60

                #8
                Originally posted by shuvo2k6
                chld.Top = (MDIForm.Height - chld.Height) / 2
                chld.Left = (MDIForm.Width - chld.Width) / 2
                Its not working correctly.

                Comment

                • pentahari
                  New Member
                  • Dec 2007
                  • 60

                  #9
                  Private Sub mnulogin_Click( )
                  CenterChild Mainform, Login
                  End Sub

                  Sub CenterChild(Par ent As Form, Child As Form)
                  On Error Resume Next
                  Dim iTop As Integer
                  Dim iLeft As Integer

                  iTop =(Parent.Height - Child.Height) / 2)
                  iLeft = (Parent.Width - Child.Width) / 2)
                  Child.Move iLeft, iTop
                  End Sub


                  I find the Correct Coding for this question.

                  My mistake is don't insert Form.Move function

                  Comment

                  • shuvo2k6
                    New Member
                    • Jan 2008
                    • 68

                    #10
                    Originally posted by pentahari
                    Private Sub mnulogin_Click( )
                    CenterChild Mainform, Login
                    End Sub

                    Sub CenterChild(Par ent As Form, Child As Form)
                    On Error Resume Next
                    Dim iTop As Integer
                    Dim iLeft As Integer

                    iTop =(Parent.Height - Child.Height) / 2)
                    iLeft = (Parent.Width - Child.Width) / 2)
                    Child.Move iLeft, iTop
                    End Sub


                    I find the Correct Coding for this question.

                    My mistake is don't insert Form.Move function
                    I cann't understand what is difference between This code and ur code:

                    Code:
                    Private Sub Command1_Click() 
                    Load Child
                    Child.Top = (Parent.Height - Child.Height) / 2
                    Child.Left = (Parent.Width - Child.Width) / 2 
                    Child.Show
                    End Sub
                    Thnx, good luck.

                    Comment

                    • pentahari
                      New Member
                      • Dec 2007
                      • 60

                      #11
                      Originally posted by shuvo2k6
                      I cann't understand what is difference between This code and ur code:

                      Code:
                      Private Sub Command1_Click() 
                      Load Child
                      Child.Top = (Parent.Height - Child.Height) / 2
                      Child.Left = (Parent.Width - Child.Width) / 2 
                      Child.Show
                      End Sub
                      Thnx, good luck.
                      Sorry i have the mistake, your code is very correctly and clearly.

                      Thank you very much for your reply.

                      Please give the reply for me. I am waiting for your reply.

                      Comment

                      • shuvo2k6
                        New Member
                        • Jan 2008
                        • 68

                        #12
                        Originally posted by pentahari
                        Sorry i have the mistake, your code is very correctly and clearly.

                        Thank you very much for your reply.

                        Please give the reply for me. I am waiting for your reply.
                        Thnkx friend, Go ahead.........

                        Comment

                        Working...