P
Paitum
Dear WindowsForms Community,
I have a question about using ContextMenuStrips with TreeNodes.
Is there a clean OOP way of determining the TreeNode which was right-clicked
on within the Click event-handlers of my ContextMenuStrip?
private void addToolStripMenuItem_Click(object sender, EventArgs e)
{
// sender is a ToolStripMenuItem object
// e contains no information
// contextMenuStrip.SourceControl is a TreeView
}
One would expect the contextMenuStrip.SourceControl to provide the TreeNode
registered to the menu, but instead it provides the TreeView.
I have a question about using ContextMenuStrips with TreeNodes.
Is there a clean OOP way of determining the TreeNode which was right-clicked
on within the Click event-handlers of my ContextMenuStrip?
private void addToolStripMenuItem_Click(object sender, EventArgs e)
{
// sender is a ToolStripMenuItem object
// e contains no information
// contextMenuStrip.SourceControl is a TreeView
}
One would expect the contextMenuStrip.SourceControl to provide the TreeNode
registered to the menu, but instead it provides the TreeView.