菜单工具条悬停启用?

时间:2012-04-15 10:39:48

标签: c# winforms c#-4.0 toolstrip

我在表单中使用了菜单工具条!当我的光标悬停在它上面时,我希望菜单被放下!怎么做?

1 个答案:

答案 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();
}