Could someone explain how to merge the form menu with the mdi container
window. The menu strip items on the form window merge but I either end up
with a blank blue menu on the form or top list of items that don't do
anything.
MDI Container.IsMdiContainer = true
MenuStrip.AllowMerge = true
/// First menu items
this.miFile.MergeAction = System.Windows.Forms.MergeAction.Insert;
this.miFile.MergeIndex = 1;
this.miFile.Name = "miFile";
this.miFile.Size = new System.Drawing.Size(35, 20);
this.miFile.Text = "&File";
/// On the sub form
this.miFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[]
{
this.toolStripSeparator1,
this.miClose});
this.miFile.MergeAction = System.Windows.Forms.MergeAction.MatchOnly;
this.miFile.MergeIndex = 1;
this.miFile.Name = "miFile";
this.miFile.Size = new System.Drawing.Size(35, 20);
this.miFile.Text = "&File";
Regards,
John 4 21650
I struggled with this for ages and eventually, by trial and error, got it
working. Best to show where I got to with an illustration of the MergeAction
and MergeIndex values
MDI parent form has a "File" menu with the generally available options:
Item Merge Action Merge Index
File Append 1
New Append 2
Open Append 2
Print Setup Append 25
Exit Append 99
All of these items are handled by methods on the MDI parent form.
The MDI child form also has a file menu, with options specific to a child
form:
Item Merge Action Merge Index
File MatchOnly -1
Close Insert 2 (Inserts
Close after item 2)
---- Insert 3 (separator
bar)
Save Insert 4
Save-as Insert 5
----- Insert 6
Print Insert 7
Print Preview Insert 8
All of these menu items are handled by methods on the mdi child form. When a
child form is opened, the entire child menu gets merged between the "open"
and "Print setup" items of the parent menu.
Next job was to insert an "edit" menu after the "file" menu. Since there is
no such menu on the parent form, I needed to add a new one from the child
form. On the child, I defined:
Item Merge Action Merge Index
Edit Insert 2
Undo Append -1
< rest of the options are the same >
In this case, because the Edit menu is a top level menu, it gets inserted
after top level item "1", which is the "file" menu from the parent form.
Because there is no merging of lower level items, I can append them all in
the child form.
Hope some of that makes sense. I have no idea whether it's the "right" thing
to do because the documentation and examples are non-existent. However, it
works.
You'll also be pleased to know that, when you come to merge toolbars, the
rules change completely!
HTH
Steve
"John J. Hughes II" <no@invalid.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... Could someone explain how to merge the form menu with the mdi container window. The menu strip items on the form window merge but I either end up with a blank blue menu on the form or top list of items that don't do anything.
MDI Container.IsMdiContainer = true
MenuStrip.AllowMerge = true /// First menu items this.miFile.MergeAction = System.Windows.Forms.MergeAction.Insert; this.miFile.MergeIndex = 1; this.miFile.Name = "miFile"; this.miFile.Size = new System.Drawing.Size(35, 20); this.miFile.Text = "&File";
/// On the sub form this.miFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator1, this.miClose}); this.miFile.MergeAction = System.Windows.Forms.MergeAction.MatchOnly; this.miFile.MergeIndex = 1; this.miFile.Name = "miFile"; this.miFile.Size = new System.Drawing.Size(35, 20); this.miFile.Text = "&File";
Regards, John
Steve,
First thanks for the detailed response.
I sort of fixed the problem by setting the child form's menu strip visible
property to false.
I change my menus based on your suggestion. Mainly changed the parent menu
upper items to "Append" with the location index being correct for where I
want them. Then I changed the child form menu items parents to -1 / match
only. I can only assume they are using the name to match with so I made
sure the name are the same.
All the sub items are merging correctly on the parent menu but the child
form still has a menu strip with a list of parent items that does nothing.
Oh well as I said I changed the child menu form's menu strip visible
property to false and the problem seems to be solved.
And yes I agree a good sample would be nice from MS. The compression sample
the BOL leads you too is beyond useless.
Don't you just love guessing games?
Regards,
John
"Steve Barnett" <no****@nodomain.com> wrote in message
news:eJ****************@TK2MSFTNGP11.phx.gbl... I struggled with this for ages and eventually, by trial and error, got it working. Best to show where I got to with an illustration of the MergeAction and MergeIndex values
MDI parent form has a "File" menu with the generally available options:
Item Merge Action Merge Index File Append 1 New Append 2 Open Append 2 Print Setup Append 25 Exit Append 99
All of these items are handled by methods on the MDI parent form.
The MDI child form also has a file menu, with options specific to a child form:
Item Merge Action Merge Index File MatchOnly -1 Close Insert 2 (Inserts Close after item 2) ---- Insert 3 (separator bar) Save Insert 4 Save-as Insert 5 ----- Insert 6 Print Insert 7 Print Preview Insert 8
All of these menu items are handled by methods on the mdi child form. When a child form is opened, the entire child menu gets merged between the "open" and "Print setup" items of the parent menu.
Next job was to insert an "edit" menu after the "file" menu. Since there is no such menu on the parent form, I needed to add a new one from the child form. On the child, I defined:
Item Merge Action Merge Index Edit Insert 2 Undo Append -1 < rest of the options are the same >
In this case, because the Edit menu is a top level menu, it gets inserted after top level item "1", which is the "file" menu from the parent form. Because there is no merging of lower level items, I can append them all in the child form.
Hope some of that makes sense. I have no idea whether it's the "right" thing to do because the documentation and examples are non-existent. However, it works.
You'll also be pleased to know that, when you come to merge toolbars, the rules change completely!
HTH Steve
"John J. Hughes II" <no@invalid.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... Could someone explain how to merge the form menu with the mdi container window. The menu strip items on the form window merge but I either end up with a blank blue menu on the form or top list of items that don't do anything.
MDI Container.IsMdiContainer = true
MenuStrip.AllowMerge = true /// First menu items this.miFile.MergeAction = System.Windows.Forms.MergeAction.Insert; this.miFile.MergeIndex = 1; this.miFile.Name = "miFile"; this.miFile.Size = new System.Drawing.Size(35, 20); this.miFile.Text = "&File";
/// On the sub form this.miFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator1, this.miClose}); this.miFile.MergeAction = System.Windows.Forms.MergeAction.MatchOnly; this.miFile.MergeIndex = 1; this.miFile.Name = "miFile"; this.miFile.Size = new System.Drawing.Size(35, 20); this.miFile.Text = "&File";
Regards, John
Sorry, yes, you're right - I didn't say to hide the menu strip on the child
form. I am doing that too.
The items that are appropriate for the parent form are handled by the parent
form... that's where I put their handlers. This for the child are handled by
the child because that's where I put their handlers. I have no "duplicate"
items on both forms though... you seem to imply you do.
You'll have far more fun when you get to merge tool bars - they merged
automatically in the Beta version of VC# Express and then stopped merging
automatically in the final release. I now have to merge them my self with
some very unintuitive code.
At some stage, I may strip out the more advanced stuff I put in to my editor
and upload it as an example to CodeProject... either that or I'll have
Christmas off!
All the best
Steve
"John J. Hughes II" <no@invalid.com> wrote in message
news:uu*************@TK2MSFTNGP12.phx.gbl... Steve,
First thanks for the detailed response.
I sort of fixed the problem by setting the child form's menu strip visible property to false.
I change my menus based on your suggestion. Mainly changed the parent menu upper items to "Append" with the location index being correct for where I want them. Then I changed the child form menu items parents to -1 / match only. I can only assume they are using the name to match with so I made sure the name are the same.
All the sub items are merging correctly on the parent menu but the child form still has a menu strip with a list of parent items that does nothing. Oh well as I said I changed the child menu form's menu strip visible property to false and the problem seems to be solved.
And yes I agree a good sample would be nice from MS. The compression sample the BOL leads you too is beyond useless.
Don't you just love guessing games?
Regards, John
"Steve Barnett" <no****@nodomain.com> wrote in message news:eJ****************@TK2MSFTNGP11.phx.gbl...I struggled with this for ages and eventually, by trial and error, got it working. Best to show where I got to with an illustration of the MergeAction and MergeIndex values
MDI parent form has a "File" menu with the generally available options:
Item Merge Action Merge Index File Append 1 New Append 2 Open Append 2 Print Setup Append 25 Exit Append 99
All of these items are handled by methods on the MDI parent form.
The MDI child form also has a file menu, with options specific to a child form:
Item Merge Action Merge Index File MatchOnly -1 Close Insert 2 (Inserts Close after item 2) ---- Insert 3 (separator bar) Save Insert 4 Save-as Insert 5 ----- Insert 6 Print Insert 7 Print Preview Insert 8
All of these menu items are handled by methods on the mdi child form. When a child form is opened, the entire child menu gets merged between the "open" and "Print setup" items of the parent menu.
Next job was to insert an "edit" menu after the "file" menu. Since there is no such menu on the parent form, I needed to add a new one from the child form. On the child, I defined:
Item Merge Action Merge Index Edit Insert 2 Undo Append -1 < rest of the options are the same >
In this case, because the Edit menu is a top level menu, it gets inserted after top level item "1", which is the "file" menu from the parent form. Because there is no merging of lower level items, I can append them all in the child form.
Hope some of that makes sense. I have no idea whether it's the "right" thing to do because the documentation and examples are non-existent. However, it works.
You'll also be pleased to know that, when you come to merge toolbars, the rules change completely!
HTH Steve
"John J. Hughes II" <no@invalid.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... Could someone explain how to merge the form menu with the mdi container window. The menu strip items on the form window merge but I either end up with a blank blue menu on the form or top list of items that don't do anything.
MDI Container.IsMdiContainer = true
MenuStrip.AllowMerge = true /// First menu items this.miFile.MergeAction = System.Windows.Forms.MergeAction.Insert; this.miFile.MergeIndex = 1; this.miFile.Name = "miFile"; this.miFile.Size = new System.Drawing.Size(35, 20); this.miFile.Text = "&File";
/// On the sub form this.miFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator1, this.miClose}); this.miFile.MergeAction = System.Windows.Forms.MergeAction.MatchOnly; this.miFile.MergeIndex = 1; this.miFile.Name = "miFile"; this.miFile.Size = new System.Drawing.Size(35, 20); this.miFile.Text = "&File";
Regards, John
Yea it was the visable thing that was throwing me. Very not obvious!
Just the parent items are common form the form to the parent. It was just
having the parent item on both the form and the container was a bit
confusing and ugly.
I don't think I will do the toolbar thing. I don't have much of a problem
on the few windows I have that use them just being on the form itself.
Thanks again for the help.
Regards,
John
"Steve Barnett" <no****@nodomain.com> wrote in message
news:em*************@TK2MSFTNGP11.phx.gbl... Sorry, yes, you're right - I didn't say to hide the menu strip on the child form. I am doing that too.
The items that are appropriate for the parent form are handled by the parent form... that's where I put their handlers. This for the child are handled by the child because that's where I put their handlers. I have no "duplicate" items on both forms though... you seem to imply you do.
You'll have far more fun when you get to merge tool bars - they merged automatically in the Beta version of VC# Express and then stopped merging automatically in the final release. I now have to merge them my self with some very unintuitive code.
At some stage, I may strip out the more advanced stuff I put in to my editor and upload it as an example to CodeProject... either that or I'll have Christmas off!
All the best Steve
"John J. Hughes II" <no@invalid.com> wrote in message news:uu*************@TK2MSFTNGP12.phx.gbl... Steve,
First thanks for the detailed response.
I sort of fixed the problem by setting the child form's menu strip visible property to false.
I change my menus based on your suggestion. Mainly changed the parent menu upper items to "Append" with the location index being correct for where I want them. Then I changed the child form menu items parents to -1 / match only. I can only assume they are using the name to match with so I made sure the name are the same.
All the sub items are merging correctly on the parent menu but the child form still has a menu strip with a list of parent items that does nothing. Oh well as I said I changed the child menu form's menu strip visible property to false and the problem seems to be solved.
And yes I agree a good sample would be nice from MS. The compression sample the BOL leads you too is beyond useless.
Don't you just love guessing games?
Regards, John
"Steve Barnett" <no****@nodomain.com> wrote in message news:eJ****************@TK2MSFTNGP11.phx.gbl...I struggled with this for ages and eventually, by trial and error, got it working. Best to show where I got to with an illustration of the MergeAction and MergeIndex values
MDI parent form has a "File" menu with the generally available options:
Item Merge Action Merge Index File Append 1 New Append 2 Open Append 2 Print Setup Append 25 Exit Append 99
All of these items are handled by methods on the MDI parent form.
The MDI child form also has a file menu, with options specific to a child form:
Item Merge Action Merge Index File MatchOnly -1 Close Insert 2 (Inserts Close after item 2) ---- Insert 3 (separator bar) Save Insert 4 Save-as Insert 5 ----- Insert 6 Print Insert 7 Print Preview Insert 8
All of these menu items are handled by methods on the mdi child form. When a child form is opened, the entire child menu gets merged between the "open" and "Print setup" items of the parent menu.
Next job was to insert an "edit" menu after the "file" menu. Since there is no such menu on the parent form, I needed to add a new one from the child form. On the child, I defined:
Item Merge Action Merge Index Edit Insert 2 Undo Append -1 < rest of the options are the same >
In this case, because the Edit menu is a top level menu, it gets inserted after top level item "1", which is the "file" menu from the parent form. Because there is no merging of lower level items, I can append them all in the child form.
Hope some of that makes sense. I have no idea whether it's the "right" thing to do because the documentation and examples are non-existent. However, it works.
You'll also be pleased to know that, when you come to merge toolbars, the rules change completely!
HTH Steve
"John J. Hughes II" <no@invalid.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... Could someone explain how to merge the form menu with the mdi container window. The menu strip items on the form window merge but I either end up with a blank blue menu on the form or top list of items that don't do anything.
MDI Container.IsMdiContainer = true
MenuStrip.AllowMerge = true /// First menu items this.miFile.MergeAction = System.Windows.Forms.MergeAction.Insert; this.miFile.MergeIndex = 1; this.miFile.Name = "miFile"; this.miFile.Size = new System.Drawing.Size(35, 20); this.miFile.Text = "&File";
/// On the sub form this.miFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator1, this.miClose}); this.miFile.MergeAction = System.Windows.Forms.MergeAction.MatchOnly; this.miFile.MergeIndex = 1; this.miFile.Name = "miFile"; this.miFile.Size = new System.Drawing.Size(35, 20); this.miFile.Text = "&File";
Regards, John
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Javier Alpizar |
last post by:
Hi,
I'm setting the Allowmerge property of both the parent and child menustrip
but it doesn't work. I get two different menus instead of merged one when I
open a child window. Am I missing...
|
by: Alvo von Cossel I |
last post by:
hi,
i have a modern looking application without the cotrolbox-bar because i've
created my own. i have a restore down button with an image that has a grey
background. if the user has a different...
|
by: rellik |
last post by:
Hi All,
I've run into a problem with the MenuStrip control and any help would be
greatly appreciated!
The problem I've got is that when use a control derived from the MenuStrip
class all MDI...
|
by: academic |
last post by:
I'm having a problem merging a ContextMenuStrip for a UserControl to the
MenuStrip on the form containing the UserControl.
I tried the following thinking that it is equivalent to cloning the...
|
by: academic |
last post by:
Using
ToolStripManager.Merge(ToolStrip,ToolStrip)
I've been able to merge a MenuStrip into a MenuStrip but never a
ContextMenuStrip into a MenuStrip.
From the docs it seems to me I should be...
| |
by: MyndPhlyp |
last post by:
Newbie alert!
VB 2005 Express. One MDIParent form and one regular Form. The MDIParent has
the standard ToolStrip. The MDI Child Form has its own ToolStrip that is to
be merged onto the...
|
by: Chris Peeters |
last post by:
Hi,
I have an MDI-application running with 1 MDI chilld showing in
'Normal'-WindowState, so NOT maximized.
What I see is the MDI-main window showing its title bar, below that the
menustrip with...
|
by: =?Utf-8?B?Sm9obiBG?= |
last post by:
Hello all,
Is there anyway to stop a child form's minimize,maximize,close and system
menu from automatically merging with the MDI parent's menustrip when you
click the maximize button on the...
|
by: kyungdongkim |
last post by:
Hi,
I have a dynamically generated MenuStrip following this example:
http://www.codeproject.com/useritems/Dynamic_MenuStrip.asp
Basically the menu strip allows users to save and load reports. ...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
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...
| |