Home All Groups Group Topic Archive Search About
Author
10 Apr 2006 6:09 PM
vul
I have an MDI application with a ListBar on the left side of MDI form. All
child forms are displayed inside of the client area of MDI form.
Now I need to display a third form from a child and center it related to the
calling Child form. I cannot find the way to do that.

Any help please
Al

Author
10 Apr 2006 6:41 PM
SStory
What if you set the owner or parent property of the subchild form to the
childform?

Show quoteHide quote
"vul" <a**@optonline.net> wrote in message
news:OcaNpnMXGHA.4432@TK2MSFTNGP04.phx.gbl...
>I have an MDI application with a ListBar on the left side of MDI form. All
>child forms are displayed inside of the client area of MDI form.
> Now I need to display a third form from a child and center it related to
> the calling Child form. I cannot find the way to do that.
>
> Any help please
> Al
>
>
Author
10 Apr 2006 6:52 PM
Al
I tried to set
Me.Parent = Supplier (Supplier is a caller form) and got an error:
Top-level control cannot be added to a control.

ParentForm property is ReadOnly, so I cannot use it.
Then I tried
Me.Owner = Supplier

It doesn't center the third form in the calling one. It centers in MDI

Thank you

Al

Show quoteHide quote
"SStory" <nospam@nospam.com> wrote in message
news:OqYlE5MXGHA.4768@TK2MSFTNGP05.phx.gbl...
> What if you set the owner or parent property of the subchild form to the
> childform?
>
> "vul" <a**@optonline.net> wrote in message
> news:OcaNpnMXGHA.4432@TK2MSFTNGP04.phx.gbl...
>>I have an MDI application with a ListBar on the left side of MDI form. All
>>child forms are displayed inside of the client area of MDI form.
>> Now I need to display a third form from a child and center it related to
>> the calling Child form. I cannot find the way to do that.
>>
>> Any help please
>> Al
>>
>>
>
>
Author
10 Apr 2006 11:02 PM
tommaso.gastaldi
hi Al,

try these and let me know:

        'SOLUTION 1:
        'ChildOfMDIChild is owned MDIChild: stays on top
        'of it and moves independently

        Dim ChildOfMDIChild1 As New Form
        With ChildOfMDIChild1
            .Owner = Me
            .StartPosition = FormStartPosition.Manual
            .Location = New Point(.Owner.Left + (.Owner.Width - .Width)
\ 2, _
                                  .Owner.Top + (.Owner.Height -
..Height) \ 2)
            .Show()
        End With


        'SOLUTION 2:
        'ChildOfMDIChild is within MDIChild and moves with it
        'cannot exit from MDIChild (behaves somehow like a control)

        Dim ChildOfMDIChild2 As New Form
        With ChildOfMDIChild2
            .TopLevel = False
            .Parent = Me
            .Location = New Point((.Parent.Width - .Width) \ 2, _
                                  (.Parent.Height - .Height) \ 2)
            .Show()
        End With



-tom


Al ha scritto:

Show quoteHide quote
> I tried to set
> Me.Parent = Supplier (Supplier is a caller form) and got an error:
> Top-level control cannot be added to a control.
>
> ParentForm property is ReadOnly, so I cannot use it.
> Then I tried
> Me.Owner = Supplier
>
> It doesn't center the third form in the calling one. It centers in MDI
>
> Thank you
>
> Al
>
> "SStory" <nospam@nospam.com> wrote in message
> news:OqYlE5MXGHA.4768@TK2MSFTNGP05.phx.gbl...
> > What if you set the owner or parent property of the subchild form to the
> > childform?
> >
> > "vul" <a**@optonline.net> wrote in message
> > news:OcaNpnMXGHA.4432@TK2MSFTNGP04.phx.gbl...
> >>I have an MDI application with a ListBar on the left side of MDI form. All
> >>child forms are displayed inside of the client area of MDI form.
> >> Now I need to display a third form from a child and center it related to
> >> the calling Child form. I cannot find the way to do that.
> >>
> >> Any help please
> >> Al
> >>
> >>
> >
> >
Author
11 Apr 2006 12:39 AM
Al
Thanbk you Tom
No success.
First solution centers the third form inside of MDI, not the child who calls
a third form. It's because the child has Location 0,0 within MDI, but as I
said in my initial post, there is a List Bar on the left side in MDI.

The second solution doesn't work too by many reasons.
My third form must be modal, and I use ShowDialog. ShowDialog is not allowed
for not top level forms, if I try to use Show, the form just doesn't appear.
I don't know why.

I was hoping that there is a simple solution, like the change one or 2
settings. I've been thinking about calculation for  Location of the third
form, but decided to look for a more elegant solution.
At least temporarily I'll use your approach - I'll calculate Location for
the third form.

Thank you
Al
<tommaso.gasta***@uniroma1.it> wrote in message
Show quoteHide quote
news:1144710175.746532.161680@g10g2000cwb.googlegroups.com...
> hi Al,
>
> try these and let me know:
>
>        'SOLUTION 1:
>        'ChildOfMDIChild is owned MDIChild: stays on top
>        'of it and moves independently
>
>        Dim ChildOfMDIChild1 As New Form
>        With ChildOfMDIChild1
>            .Owner = Me
>            .StartPosition = FormStartPosition.Manual
>            .Location = New Point(.Owner.Left + (.Owner.Width - .Width)
> \ 2, _
>                                  .Owner.Top + (.Owner.Height -
> .Height) \ 2)
>            .Show()
>        End With
>
>
>        'SOLUTION 2:
>        'ChildOfMDIChild is within MDIChild and moves with it
>        'cannot exit from MDIChild (behaves somehow like a control)
>
>        Dim ChildOfMDIChild2 As New Form
>        With ChildOfMDIChild2
>            .TopLevel = False
>            .Parent = Me
>            .Location = New Point((.Parent.Width - .Width) \ 2, _
>                                  (.Parent.Height - .Height) \ 2)
>            .Show()
>        End With
>
>
>
> -tom
>
>
> Al ha scritto:
>
>> I tried to set
>> Me.Parent = Supplier (Supplier is a caller form) and got an error:
>> Top-level control cannot be added to a control.
>>
>> ParentForm property is ReadOnly, so I cannot use it.
>> Then I tried
>> Me.Owner = Supplier
>>
>> It doesn't center the third form in the calling one. It centers in MDI
>>
>> Thank you
>>
>> Al
>>
>> "SStory" <nospam@nospam.com> wrote in message
>> news:OqYlE5MXGHA.4768@TK2MSFTNGP05.phx.gbl...
>> > What if you set the owner or parent property of the subchild form to
>> > the
>> > childform?
>> >
>> > "vul" <a**@optonline.net> wrote in message
>> > news:OcaNpnMXGHA.4432@TK2MSFTNGP04.phx.gbl...
>> >>I have an MDI application with a ListBar on the left side of MDI form.
>> >>All
>> >>child forms are displayed inside of the client area of MDI form.
>> >> Now I need to display a third form from a child and center it related
>> >> to
>> >> the calling Child form. I cannot find the way to do that.
>> >>
>> >> Any help please
>> >> Al
>> >>
>> >>
>> >
>> >
>
Author
11 Apr 2006 1:31 AM
tommaso.gastaldi
Well ... that's really strange. I jave just retried it on my pc (using
vb2003) and the first solution centers the third form inside its owner,
not the MDI form, like you report (?). If I move the child the form and
open the form, it is always centered within the MDI child.

Are you sure you have pasted exactly the same code. Note that is
important the sequence of statements and  .StartPosition =
FormStartPosition.Manual...

- tom

Al ha scritto:

Show quoteHide quote
> Thanbk you Tom
> No success.
> First solution centers the third form inside of MDI, not the child who calls
> a third form. It's because the child has Location 0,0 within MDI, but as I
> said in my initial post, there is a List Bar on the left side in MDI.
>
> The second solution doesn't work too by many reasons.
> My third form must be modal, and I use ShowDialog. ShowDialog is not allowed
> for not top level forms, if I try to use Show, the form just doesn't appear.
> I don't know why.
>
> I was hoping that there is a simple solution, like the change one or 2
> settings. I've been thinking about calculation for  Location of the third
> form, but decided to look for a more elegant solution.
> At least temporarily I'll use your approach - I'll calculate Location for
> the third form.
>
> Thank you
> Al
> <tommaso.gasta***@uniroma1.it> wrote in message
> news:1144710175.746532.161680@g10g2000cwb.googlegroups.com...
> > hi Al,
> >
> > try these and let me know:
> >
> >        'SOLUTION 1:
> >        'ChildOfMDIChild is owned MDIChild: stays on top
> >        'of it and moves independently
> >
> >        Dim ChildOfMDIChild1 As New Form
> >        With ChildOfMDIChild1
> >            .Owner = Me
> >            .StartPosition = FormStartPosition.Manual
> >            .Location = New Point(.Owner.Left + (.Owner.Width - .Width)
> > \ 2, _
> >                                  .Owner.Top + (.Owner.Height -
> > .Height) \ 2)
> >            .Show()
> >        End With
> >
> >
> >        'SOLUTION 2:
> >        'ChildOfMDIChild is within MDIChild and moves with it
> >        'cannot exit from MDIChild (behaves somehow like a control)
> >
> >        Dim ChildOfMDIChild2 As New Form
> >        With ChildOfMDIChild2
> >            .TopLevel = False
> >            .Parent = Me
> >            .Location = New Point((.Parent.Width - .Width) \ 2, _
> >                                  (.Parent.Height - .Height) \ 2)
> >            .Show()
> >        End With
> >
> >
> >
> > -tom
> >
> >
> > Al ha scritto:
> >
> >> I tried to set
> >> Me.Parent = Supplier (Supplier is a caller form) and got an error:
> >> Top-level control cannot be added to a control.
> >>
> >> ParentForm property is ReadOnly, so I cannot use it.
> >> Then I tried
> >> Me.Owner = Supplier
> >>
> >> It doesn't center the third form in the calling one. It centers in MDI
> >>
> >> Thank you
> >>
> >> Al
> >>
> >> "SStory" <nospam@nospam.com> wrote in message
> >> news:OqYlE5MXGHA.4768@TK2MSFTNGP05.phx.gbl...
> >> > What if you set the owner or parent property of the subchild form to
> >> > the
> >> > childform?
> >> >
> >> > "vul" <a**@optonline.net> wrote in message
> >> > news:OcaNpnMXGHA.4432@TK2MSFTNGP04.phx.gbl...
> >> >>I have an MDI application with a ListBar on the left side of MDI form.
> >> >>All
> >> >>child forms are displayed inside of the client area of MDI form.
> >> >> Now I need to display a third form from a child and center it related
> >> >> to
> >> >> the calling Child form. I cannot find the way to do that.
> >> >>
> >> >> Any help please
> >> >> Al
> >> >>
> >> >>
> >> >
> >> >
> >