Make a menu bar for the Notepad (C#)

  1. Open Visual studio and make a new Visual C# project. I named it as Notepad
  2. After the project is created, click on the form and go to propeties. Change the Text as Notepad.
  3. Now you can see your form name changed to Form1 as Notepad
  4. Then drag and drop a MenuStrip
  5. Add Menus, File and Edit
  6. Add sub Menus
    • File
      1. New
      2. Open
      3. Save
      4. Exit
    • Edit
      1. Undo
      2. Redo
      3. Cut
      4. Copy
      5. Past
      6. Select All
When you adding the menus and submenus, goto propeties -> Text change the name of menus and submenu by adding "&" mark to the front of the name.As a example change New as &New

Reason for this is ,open the notepad in your windows computer press Alt button. You can see it's manus are changing. That mean, the first letter is underlined.



When you press the underlined letter's key by using key board that manu item will working.
So add the & for all the menu and submenu items.


Do not need add & mark front of the Text. If it is there were two items start with same letter you can choose another letter.As a example for the Cut and CopyI use y for Copy
Now you can run your project and check if it is working.
  1. You can add separator to separate the submenu items.
  2. Right click on where you want to add the separator. insert -> Separator
Next time we will see how add images to the menu items and how create a short cut keys to the menu items.

No comments:

Post a Comment