本文介绍了自动隐藏菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建具有自动显示/隐藏功能的菜单,例如鼠标
轻柔地悬停自动显示,鼠标离开时自动隐藏;
就像VisualStudio中的工具箱"窗口一样,您知道何时将图钉设置为
自动隐藏它隐藏在mouse_leave上. :)
请完整说明或给我一个链接. :rose:

How can I create a menu that has auto show/hide .for example on mouse
hover auto show softly and on mouse leave auto hide;
Like Toolbox window in VisualStudio ,you know when you set the pin to
auto hide it hides on mouse_leave . :)
please explain completely or gimme a link. :rose:

推荐答案

private void Form1_MouseMove(object sender, MouseEventArgs e)
       {
            if (e.y < 40)
            {
                this.BeginInvoke((ThreadStart)delegate()
                {
                    MenuShow();

                });
            }
            else if (e.y > 100)
            {

                this.BeginInvoke((ThreadStart)delegate()
                {
                    MenuHide();

                });

            }
        }

        private void MenuShow()
        {
            while (menuStrip1.Top != 0)
            {

                menuStrip1.Top++;
                Thread.Sleep(10);
                menuStrip1.Update();
            }
        }

        private void MenuHide()
        {
            while (menuStrip1.Top != -25)
            {
                menuStrip1.Top--;
                Thread.Sleep(10);
            }
        }


private void Form1_MouseMove_1(object sender, MouseEventArgs e)
{
    if (e.Y == 10)
    {
        menuStrip1.Visible = true;
    }
    else if (e.Y > 20)
    {
        menuStrip1.Visible = false;
    }
}



谢谢N问候,
ASHISH V K



Thanks N Regards,
ASHISH V K


private void Form1_MouseMove(object sender, MouseEventArgs e)
       {


           if (e.Y > 40)
           {
               this.BeginInvoke((ThreadStart)delegate()
               {
                   MenuShow();

               });
           }
           else if (e.Y < 100)
           {

               this.BeginInvoke((ThreadStart)delegate()
               {
                   MenuHide();

               });

           }
       }


这篇关于自动隐藏菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 19:14