So erstellen Sie ein Kontextmenü in C #
Ich möchte mit C # ein Kontextmenü erstellen, das neben dem Knoten angezeigt wird, ähnlich wie hier in Visual Studio:
Der Code, den ich jetzt habe, bewirkt, dass das Hauptformular flackert.
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;
}
}
}