Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

menustrip

Posted on 2006-06-14
5
Medium Priority
?
429 Views
Last Modified: 2008-02-01
I am using the menustrip, when you click on it it automatically drops the menu.

How can I programatically close the menu that drops down when the menustrip is clicked?
0
Comment
Question by:yanci1179
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 800 total points
ID: 16908263
Why not just disable it?...

This hack below works.  Handle the DropDownOpened() event.

I hope someone can show us a better way...   =\

        private void fileToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
        {
            Timer tmr = new Timer();
            tmr.Tag = sender;
            tmr.Interval = 100;
            tmr.Tick += new EventHandler(tmr_Tick);
            tmr.Start();
        }

        void tmr_Tick(object sender, EventArgs e)
        {
            Timer tmr = (Timer)sender;
            tmr.Stop();

            ToolStripMenuItem tsmi = (ToolStripMenuItem)tmr.Tag;
            tsmi.DropDown.Close();
        }
0
 
LVL 2

Accepted Solution

by:
Anandavally_P earned 1200 total points
ID: 16909126
Hi,

Try this.

Suppose this is the menu strip sample

Menu1  Menu2
  SubMenu1
  SubMenu2

When we click on Menu1, SubMenu1 and SubMenu2 gets dropped down.
We can hide the drop down menu on the mouse leave function of Menu1.

private void menu1ToolStripMenuItem_MouseLeave(object sender, EventArgs e)
 {
            menu1ToolStripMenuItem.HideDropDown();
 }  

Thanks
Anandavally P  

0
 
LVL 11

Expert Comment

by:vo1d
ID: 16911787
why dont you just remove the submenues from the menuitem?
0
 

Author Comment

by:yanci1179
ID: 16911905
thanks anandavally P, I used the Hide Drop Down even and it work perfectly.

If I remove them, I have to re-add them when I want them to see it. Right?

Thanks everybody, I really appreciate the help.

0
 
LVL 11

Expert Comment

by:vo1d
ID: 16912932
yes correct.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question