Use of menustrip in desktop application c#

Menu(s) in desktop application c#

Hello friend, how are you? All is well?

Today we will learn how to add menu(s) in our windows(desktop) application. We will use our previous example in which we had learned how to use mdi parent form. The link is here: Introduction to mdi parent form in desktop application

Download the project and open it.

Now to add menus in desktop application we need to add menustrip control to the form. Follow the image.

add menustrip in mdi parent form
add menustrip in mdi parent form

As you can see the menustrip control is in Menus & Tollbars group control.

Now drag the menu control to the form or just double click the menustrip, it will added automatically. Now add some menus. See the example in the picture.

adding menus to the menustrip in desktop applications
adding menus to the menustrip in desktop applications

Now double click on open menu you just created and write down the following code.

private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show(“Hello!, You have clicked open menu”);
}

private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show(“Hello!, You have clicked Exit menu”);
}

Download the project menustrip in desktop application here

Happy coding……….

One Reply to “Use of menustrip in desktop application c#”

  1. Valentin

    The application is located at the top of the desktop, and the working area is appropriately resized via a hook into the SystemParametersInfo function. The MenuStrip appears as it should, with the exception that any dropdown from the MenuStrip shows as detached from the MenuStrip itself (as if it is being drawn on the new working area, as opposed to the form containing the MenuStrip).

Leave a Reply

Your email address will not be published. Required fields are marked *