【发布时间】:2012-05-30 18:07:45
【问题描述】:
我想使用 C# 创建一个上下文菜单,该菜单将显示在节点旁边,类似于在 Visual Studio 中发生的情况:
我现在的代码导致主窗体闪烁。
private void treeView1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
var myForm = new Form {Text = "My Form"};
myForm.SetBounds(10, 10, 200, 200);
myForm.Show();
// Determine if the form is modal.
if (myForm.Modal == false)
{
// Change borderstyle and make it not a top level window.
myForm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
myForm.TopLevel = false;
}
}
}
【问题讨论】:
-
你在 VS 中显示的不是模态的,它是一个上下文菜单。你在找哪个?
-
那么可能是上下文菜单
标签: c# winforms visual-studio-2010 contextmenu