我在表单中使用了菜单工具条!当我的光标悬停在它上面时,我希望菜单被放下!怎么做?
答案 0 :(得分:4)
您可以尝试使用菜单项的MouseHover
事件:
public Form1() {
InitializeComponent();
fileToolStripMenuItem.MouseHover += fileToolStripMenuItem_MouseHover;
}
private void fileToolStripMenuItem_MouseHover(object sender, EventArgs e) {
fileToolStripMenuItem.ShowDropDown();
}
或lambda版本:
public Form1() {
InitializeComponent();
fileToolStripMenuItem.MouseHover += (s, e) => fileToolStripMenuItem.ShowDropDown();
}