0

I have a c# application winForm. The form contain a tree view that show the file windows file system. I want to add an option for right click on file that open a windows context menu strip. There is a way to Integrate windows menu to my c# app?

Thank!

maz
  • 515
  • 2
  • 8
  • 22
  • (moved from an answer now that I have rep to do so) I would check out the accepted answer and most popular answer (by @Groky) in this SO question: http://stackoverflow.com/questions/451287/how-do-you-show-the-windows-explorer-context-menu-from-a-c-sharp-application – panhandel Nov 26 '13 at 20:09

1 Answers1

0

Everything is possible.

You first have to catch a right click on a node.

  private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) 
  {
    if (e.Button == MouseButtons.Right) 
    {
       treeView1.SelectedNode = e.Node;
       //Play with the context menu here.
    }
  }

On the part where you play with the context menu, you do what you want with it ( in this case make it appear at this location I guess..) You should read about the ContextMenuStrip Class for more information.

phadaphunk
  • 12,785
  • 15
  • 73
  • 107