By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,224 Members | 1,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,224 IT Pros & Developers. It's quick & easy.

Windows Forms MainMenu question

P: n/a
Hi,
I have decided to use a MainMenu in my main form. I have a menu item
"Open Form". When this item is clicked I want the "newform.frm" to open just
below the menu in the main form. How can this be done? I am using VB.Net.

Thanks for any replies.

Yoshi
Nov 22 '05 #1
Share this Question
Share on Google+
22 Replies


P: n/a
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor
Nov 22 '05 #2

P: n/a
J L
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John

On Mon, 23 May 2005 10:41:52 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor


Nov 22 '05 #3

P: n/a
J L
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John

On Mon, 23 May 2005 10:41:52 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor


Nov 22 '05 #4

P: n/a
Thanks for your reply. What code did you use in the click event of the Menu
Item?? What is the code to load the new form in the main form just below the
MainMenu?

Cheers,
Yoshi

"J L" wrote:
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John

On Mon, 23 May 2005 10:41:52 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor


Nov 22 '05 #5

P: n/a
Thanks for your reply. What code did you use in the click event of the Menu
Item?? What is the code to load the new form in the main form just below the
MainMenu?

Cheers,
Yoshi

"J L" wrote:
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John

On Mon, 23 May 2005 10:41:52 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
Yoshimitsy,

Just see where your OpenForm is on your main form. (The left is easy that is
the Left of that menu).

Than add that to the Top and the Left of your form and set before you open
your new form the Top and the Left to that.

Don't forget to set before the WindowsDefaultLocation to manual.

I hope this helps,

Cor


Nov 22 '05 #6

P: n/a
John,

Why not, assuming it is me.Top :-)
Than it looks nicely done

Cor
Nov 22 '05 #7

P: n/a
yoshimitsu,

There are 3 types of forms in window forms Net

Normal forms, modal forms and Mdi forms.

From your writing I understand it can only be a normal form or a modal form.

A modal form, which is opened with showdialog is much easier to handle than
a normal form that you open as extra form.

A modal form is easier necause that when you open a modal form the user
cannot access the original form while he can with a normal form.

You choose for the last as everybody does in the beginning. However know
that that needs much more expirience to handle all those forms and keep the
information as it has to be.

Therefore give us some information what you want.

Cor
Nov 22 '05 #8

P: n/a
John,

Why not, assuming it is me.Top :-)
Than it looks nicely done

Cor
Nov 22 '05 #9

P: n/a
yoshimitsu,

There are 3 types of forms in window forms Net

Normal forms, modal forms and Mdi forms.

From your writing I understand it can only be a normal form or a modal form.

A modal form, which is opened with showdialog is much easier to handle than
a normal form that you open as extra form.

A modal form is easier necause that when you open a modal form the user
cannot access the original form while he can with a normal form.

You choose for the last as everybody does in the beginning. However know
that that needs much more expirience to handle all those forms and keep the
information as it has to be.

Therefore give us some information what you want.

Cor
Nov 22 '05 #10

P: n/a
"J L" <jo**@marymonte.com> wrote in message
news:st********************************@4ax.com...
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John


That would work fine depending upon the formborderstyle and the actual
height of the menu. The menubar will wrap as the form is resized, but of
course, this may not be an issue in your app.

I would use:
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #11

P: n/a
"J L" <jo**@marymonte.com> wrote in message
news:st********************************@4ax.com...
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John


That would work fine depending upon the formborderstyle and the actual
height of the menu. The menubar will wrap as the form is resized, but of
course, this may not be an issue in your app.

I would use:
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #12

P: n/a
J L
Hi Mick,
I wanted to try your suggestion but can not get that syntax to work.
Please let me know if it is correct.

John

On Tue, 24 May 2005 13:10:02 +0100, "Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]>
wrote:
"J L" <jo**@marymonte.com> wrote in message
news:st********************************@4ax.com.. .
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John


That would work fine depending upon the formborderstyle and the actual
height of the menu. The menubar will wrap as the form is resized, but of
course, this may not be an issue in your app.

I would use:
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


Nov 22 '05 #13

P: n/a
J L
Hi Mick,
I wanted to try your suggestion but can not get that syntax to work.
Please let me know if it is correct.

John

On Tue, 24 May 2005 13:10:02 +0100, "Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]>
wrote:
"J L" <jo**@marymonte.com> wrote in message
news:st********************************@4ax.com.. .
Hi Cor,
I had a similar (or maybe it is the same need) to open a form just
below the title and menu bars on my main form. I had to also take into
account the size of these bars by adding to the form load event
me.Topp = _
SystemInformation.CaptionHeight +
SystemInformation.MenuHeight +
SystemInformation.Border3dSize.Height

It seemed to work. Can you confirm this is the correct way to do it?

TIA,
John


That would work fine depending upon the formborderstyle and the actual
height of the menu. The menubar will wrap as the form is resized, but of
course, this may not be an issue in your app.

I would use:
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


Nov 22 '05 #14

P: n/a
J L

Hi Cor,
Yes sometimes I stutter when I type LOL

John

On Tue, 24 May 2005 08:18:40 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
John,

Why not, assuming it is me.Top :-)
Than it looks nicely done

Cor


Nov 22 '05 #15

P: n/a
J L

Hi Cor,
Yes sometimes I stutter when I type LOL

John

On Tue, 24 May 2005 08:18:40 +0200, "Cor Ligthert"
<no************@planet.nl> wrote:
John,

Why not, assuming it is me.Top :-)
Than it looks nicely done

Cor


Nov 22 '05 #16

P: n/a
"J L" <jo**@marymonte.com> wrote in message
news:l5********************************@4ax.com...
Hi Mick,
I wanted to try your suggestion but can not get that syntax to work.
Please let me know if it is correct.

John


To expand on the code:

Dim newForm As New Form
newForm.StartPosition = FormStartPosition.Manual
newForm.Left = Me.Left
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top
newForm.ShowDialog(Me)

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #17

P: n/a
"J L" <jo**@marymonte.com> wrote in message
news:l5********************************@4ax.com...
Hi Mick,
I wanted to try your suggestion but can not get that syntax to work.
Please let me know if it is correct.

John


To expand on the code:

Dim newForm As New Form
newForm.StartPosition = FormStartPosition.Manual
newForm.Left = Me.Left
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top
newForm.ShowDialog(Me)

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #18

P: n/a
J L
Hi Mick,
This is the line I am having problems with. I can not find
ClientRectangle nor will ToScreen() show .Top property.
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


John

Nov 22 '05 #19

P: n/a
J L
Hi Mick,
This is the line I am having problems with. I can not find
ClientRectangle nor will ToScreen() show .Top property.
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


John

Nov 22 '05 #20

P: n/a
This is a 'System.Windows.Forms.Form' you're working on isn't it?

RectangleToScreen to returns a Rectangle. Top is a standard property of
Rectangle.
ClientRectangle is a standard ReadOnly property of Control.

Or are you saying that they don't show up in Intellisense?

Top should show, but ClientRectangle is an advanced member which is hidden
by default. Just because it's not in intellisense does not mean you can't
use it.

Clear the Hide advanced members checkbox.
Tools --> Options --> Text Editor --> Basic --> General

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"J L" <jo**@marymonte.com> wrote in message
news:9s********************************@4ax.com...
Hi Mick,
This is the line I am having problems with. I can not find
ClientRectangle nor will ToScreen() show .Top property.
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


John

Nov 22 '05 #21

P: n/a
This is a 'System.Windows.Forms.Form' you're working on isn't it?

RectangleToScreen to returns a Rectangle. Top is a standard property of
Rectangle.
ClientRectangle is a standard ReadOnly property of Control.

Or are you saying that they don't show up in Intellisense?

Top should show, but ClientRectangle is an advanced member which is hidden
by default. Just because it's not in intellisense does not mean you can't
use it.

Clear the Hide advanced members checkbox.
Tools --> Options --> Text Editor --> Basic --> General

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"J L" <jo**@marymonte.com> wrote in message
news:9s********************************@4ax.com...
Hi Mick,
This is the line I am having problems with. I can not find
ClientRectangle nor will ToScreen() show .Top property.
newForm.Top = Me.RectangleToScreen(Me.ClientRectangle).Top


John

Nov 22 '05 #22

P: n/a
J L
Hi Mick,
That did the trick I was looking at Intellisense. Thank you so much
for your persistance and support. That works prefectly!!

John

On Fri, 27 May 2005 10:25:25 +0100, "Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]>
wrote:
This is a 'System.Windows.Forms.Form' you're working on isn't it?

RectangleToScreen to returns a Rectangle. Top is a standard property of
Rectangle.
ClientRectangle is a standard ReadOnly property of Control.

Or are you saying that they don't show up in Intellisense?

Top should show, but ClientRectangle is an advanced member which is hidden
by default. Just because it's not in intellisense does not mean you can't
use it.

Clear the Hide advanced members checkbox.
Tools --> Options --> Text Editor --> Basic --> General


Nov 22 '05 #23

This discussion thread is closed

Replies have been disabled for this discussion.