473,486 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Center in Child

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
Apr 10 '06 #1
5 4442
What if you set the owner or parent property of the subchild form to the
childform?

"vul" <aa*@optonline.net> wrote in message
news:Oc**************@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

Apr 10 '06 #2
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

"SStory" <no****@nospam.com> wrote in message
news:Oq**************@TK2MSFTNGP05.phx.gbl...
What if you set the owner or parent property of the subchild form to the
childform?

"vul" <aa*@optonline.net> wrote in message
news:Oc**************@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


Apr 10 '06 #3
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" <no****@nospam.com> wrote in message
news:Oq**************@TK2MSFTNGP05.phx.gbl...
What if you set the owner or parent property of the subchild form to the
childform?

"vul" <aa*@optonline.net> wrote in message
news:Oc**************@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



Apr 10 '06 #4
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
<to**************@uniroma1.it> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.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" <no****@nospam.com> wrote in message
news:Oq**************@TK2MSFTNGP05.phx.gbl...
> What if you set the owner or parent property of the subchild form to
> the
> childform?
>
> "vul" <aa*@optonline.net> wrote in message
> news:Oc**************@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
>>
>>
>
>

Apr 11 '06 #5

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:
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
<to**************@uniroma1.it> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.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" <no****@nospam.com> wrote in message
news:Oq**************@TK2MSFTNGP05.phx.gbl...
> What if you set the owner or parent property of the subchild form to
> the
> childform?
>
> "vul" <aa*@optonline.net> wrote in message
> news:Oc**************@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
>>
>>
>
>


Apr 11 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
9209
by: FL | last post by:
Hi Everyone, I know howto center a block using margin-left: auto ; margin-right: auto ; but I'm trying to center vertically a box, any idea to solve this?
3
4711
by: Zack Sessions | last post by:
I am using VB.NET 2003. I have read the threads concerning the problem where the FormStartPosition of CenterParent is ignored if the form is displayed with the Show method as opposed to the...
0
8547
by: Innova | last post by:
Hi, We are working on a gridview inside the gridview (parent-child) scenario. The data of child grid will depend on the data of parent. Objectives: 1.Add new row in parent grid after each row...
0
894
by: slemen | last post by:
Hi, I'm creating column templates dynamically at runtime. How do I center within the column 2 check boxes in each column header? The columns are created using the technique described in MSDN...
12
2160
by: robertino | last post by:
Hi all, I've put together a few SPs to produce a BOM (bill of materials) listing, which together use a couple of global temp tables, and return the results from a cursor. Here's the code: ...
1
15076
by: Brett Romero | last post by:
I set an MDI child form to Windowstate=maximized at design time. When I new up and show the child form in the MDI parent, the child's title is hidden since it's pushed to far up (below parent tool...
1
1575
by: Brett Romero | last post by:
I'm using .NET 2.0. I have an MDI app. When I create the first child form, it appears in the upper left part of the MDI parent. The MDI parent is larger than the child. I have the child set to...
1
2235
by: Lagon666 | last post by:
How can i set the #contain div's background same as #wrapper background? (Child element background same as father elemenet background). This source works in Firefox but how can i fix it in IE (IE6)?...
6
4886
semanticnotion
by: semanticnotion | last post by:
Hi sir i want to transform the data of one table into another through foreign key but the following error come to my browser Here is my code and data base structure. CREATE TABLE IF NOT...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5434
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4865
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.