static TreeNode Parentnode;
public void Attack_Trees()
{
treeView2.Nodes.Clear();
for (int i = 0; i < ThreatEvaluationInstances.Count; i++)
{
Parentnode = new TreeNode(ThreatEvaluationInstances.ElementAt(i).Threat1);
treeView2.Nodes.Add(Parentnode);
}
}
private void addNodeToolStripMenuItem_Click(object sender, EventArgs e)
{
//How can i implement this
}
到目前为止,这是我能够将所有父节点添加到树视图中的过程,并且还向上下文添加了contextMenuStrip,但是我的目标是当用户右键单击它时将显示“添加节点”(我已经实现),我想在用户选择的父节点上添加子节点