欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C# menuStrip控件實(shí)現(xiàn)鼠標(biāo)滑過自動(dòng)彈出功能

 更新時(shí)間:2021年07月06日 08:43:14   作者:許寶  
MenuStrip 控件是 Visual Studio 和 .NET Framework 中的功能。使用該控件,可以輕松創(chuàng)建 Microsoft Office 中那樣的菜單。本文給大家分享menuStrip鼠標(biāo)滑過自動(dòng)彈出效果

Menustrip控件是一個(gè)菜單欄控件,可以加載菜單欄,在很多系統(tǒng)中都有用到。本文介紹下該控件的一些屬性的常用方式。

在頁面FormMain_Load里面添加如下注冊(cè)事件:

 for (int i = 0; i < this.toolStrip1.Items.Count; i++) {
                this.toolStrip1.Items[i].MouseHover += new EventHandler(toolStrip1_MouseHover);
            }

添加方法:

private void toolStrip1_MouseHover(object sender, EventArgs e) {
            if (sender is ToolStripDropDownItem) {
                ToolStripDropDownItem item = sender as ToolStripDropDownItem;
                if (item.HasDropDownItems && !item.DropDown.Visible) {
                    item.ShowDropDown();
                }
            }

        }

擴(kuò)展:下面在分享一段示例代碼:menuStrip鼠標(biāo)經(jīng)過自動(dòng)顯示菜單

//---------------------------------------------------------------------------------
private void Form1_Load(object sender, EventArgs e)
{
    this.menuStrip1.Items[0].MouseHover += new EventHandler(Form1_MouseHover);
}

//---------------------------------------------------------------------------------
void Form1_MouseHover(object sender, EventArgs e)
{
    if (sender is ToolStripDropDownItem)
    {
        ToolStripDropDownItem item = sender as ToolStripDropDownItem;
        if (item.HasDropDownItems && !item.DropDown.Visible)
        {
            item.ShowDropDown();
        }
    }
}

到此這篇關(guān)于menuStrip鼠標(biāo)滑過自動(dòng)彈出的文章就介紹到這了,更多相關(guān)menuStrip鼠標(biāo)滑過自動(dòng)彈出內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論