 |
|
 |
I used this great tool in my codes. But I found that when I used more than one context menu with this functionality it crashes. I found the reason being there are some static members in the NiceMenu class that adversely interacts when there are more instances. Thought this comment is useful.
|
|
|
|
 |
|
 |
I tried to convert ToolStripMenuItem. But it returns erros.
Any body can help me?.
Thanks
Kutty
|
|
|
|
 |
|
 |
For those of you that don't like doing a large if/elseif block, here is some code that uses the original click handlers from your menu items.
Create a backup of your main menu in a member variable after the InitializeComponent() call but BEFORE you create the NiceMenu object:
BackupMainMenu = MyMainMenu.CloneMenu();
MyNiceMenu = new NiceMenu();
MyNiceMenu.UpdateMenu(MyMainMenu,new NiceMenuClickEvent(MyMainMenu_Click));
Use this code inside your click handler:
private void MyMainMenu_Click(object sender, System.EventArgs e)
{
NiceMenu item = (NiceMenu)sender;
foreach( MenuItem mi in BackupMainMenu.MenuItems )
{
CheckMenu( mi, item.Text );
}
}
Add this function somewhere in your class:
private void CheckMenu( MenuItem menuitem, string text )
{
string mitext = menuitem.Text;
string IndexImage = menuitem.Text.Substring(0,2);
if (Char.IsNumber(IndexImage,1) == true)
{
mitext = menuitem.Text.Substring(2);
}
if( mitext.Equals( text ) )
{
menuitem.PerformClick();
}
foreach( MenuItem mi in menuitem.MenuItems )
{
CheckMenu( mi, text );
}
}
|
|
|
|
 |
|
 |
I do not think text comparision is a good idea. Every time you change menu text you need to edit the code. and it is slow too. How about multi language support ?.
I found that index property can be used direclty since NiceMenu is derived from MenuItem and index is unchanged from the original items.
NiceMenu item = (NiceMenu)sender;
switch ( item.Index)
{
case 0:
// call your action for menu item 1 here
break;
case 1:
// call your action for menu item 2 here
break;
}
Good Luck
Anton Fernando
|
|
|
|
 |
|
 |
Hello...
I just got in to c#.net and love it. But, I'm still virgin to this language. I have created a project that has several forms in it other than the main form. For example: I have a form call frmMain and it wants to call a form call AboutBox from the main menu.
Question is, HOW? I'm a visual studio programmer and I can't for the life of me figure out how to call the form. I tried using Application.Run(AboutBox()); and that doesn't work.
Can you give me a heads up on this simple question?
Thanx in advance.
Jim Barber
qsoft@comcast.net
|
|
|
|
 |
|
 |
In the menu item's click event handler, create an instance of the Form you want to load. Then called the form's Show() or ShowDialog() method.
example:
private void AboutBoxMenuItem_Click(object sender, Eventargs e)
{
AboutBox1 MyAboutBox = new AboutBox1();
MyAboutBox.ShowDialog();
MyAboutBox.Dispose();
}
hope that helps,
troy
|
|
|
|
 |
|
 |
Hi,
i really like this code. There's one thing i'd like to improve though: the little arrow that indicates there is a submenu disappears when hovering that menu-item... any idea how we could manage to keep that arrow?
|
|
|
|
 |
|
 |
I would like to use your ".NET Menu Style class" in my project, which is written in Managed C++.
Is it necessary to convert the entire C# class into MC++-syntax, or is there another possibility?
Thanks in advance
|
|
|
|
 |
|
 |
Hi, I cannot use MyNiceMenu.Enabled = false
It doesn't work?
|
|
|
|
 |
|
 |
This menu is very good but need enhancements
|
|
|
|
 |
|
|
 |
|
 |
The submenuItem's Checked Status can't refresh in time.
Who can help me?
|
|
|
|
 |
|
 |
Sorry,I have resolved the question!
|
|
|
|
 |
|
|
 |
|
 |
Can anyone tell me how to load the icons into the assembly resource like the RTF editor example?
|
|
|
|
 |
|
 |
What is the actula function of ModifyRegistry class?
Do we need to use this to read, write registry??
|
|
|
|
 |
|
 |
It is a nice job! I already used in my application. However, I found that the MDIList can not be updated. I created a MDI container form and tried to create some children forms and wanted to see the list of the children forms on the menu.
Do you have any idea how to implement the feature? Thanks ahead.
|
|
|
|
 |
|
 |
The code that determines if the HotkeyPrefix should be set to Hide or Show in the function DrawMenuText did not appear to be working correctly for me. So I changed the code to always set the HotkeyPrefix to HotkeyPrefix.Show and I removed the line of code that removes the ampersand(&) from the text. These two changes allowed the HotkeyPrefix to be shown correctly when the ampersand was present.
|
|
|
|
 |
|
 |
When I use the CloneMenu Method, the menu disapear
, why? It's a bug? Anyway, very good improvement!
Dim mnuMain As MainMenu = Me.ParentForm.Menu.CloneMenu
mnuCtxtrvOrders.MenuItems.Add(mnuMain.MenuItems.Item(0))
thanks
Mariano
|
|
|
|
 |
|
 |
http://www.devcomponents.com have just released their Office 2003 Menu Style.
As we here look for free stuff, how about updating this great menu with Office 2003 style ?
|
|
|
|
 |
|
 |
http://www.devcomponents.com[^]
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
 |
|
 |
Sizes are incorrect (Menu items are HUGE!). Top-level bar is incorrect. Icons are kinda dodgy. Can't someone get it right, please?
nous sommes les maitres
nous sommes les esclaves
nous sommes partout
nous sommes nul part
nous maitrisons les lettres noires
|
|
|
|
 |
|
 |
Feel free to contribute instead of whining.
|
|
|
|
 |
|
 |
If I have two menuitem equals in differents menus, e.g., File->New and Customer->New, the click event only founds File->New. How can I know exactly which menuitem was clicked ?
Thanks
|
|
|
|
 |
|
 |
You can try &New for File -> New, N&ew for File -> New and Customer. Not best solution but it work.
|
|
|
|
 |