when right clicked on the form it should show the main menu
how can i code this

I don't know exactally what you want. Your main menu is showing unless you have the visible property set to false. If that is true then use the mouse down event, check for right mouse button and set the visible property to true. If you want to turn it off then each selected menu item has to set the visible property to false.
If what you are talking about is a context menu then add one to your form and set then context menu property to point to it. Then when you right click on the form the context menu will pop up.