Click here to Skip to main content
15,920,602 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
How to set shortcut key Ribbon menu in c# windows application

Thanks,
Pawan
Posted

You have only to type & in front of the char from the sub-menu name, like in the next examples: "&Open", "E&xit".
 
Share this answer
 
Add the following code in form's constrictor

public Button SaveButton = new Button();
public Button CloseButton = new Button();

this.AcceptButton = SaveButton;
this.CancelButton = CloseButton;

this.SaveButton.Click += new System.EventHandler(this.rbnbtnSave_Click);
this.CloseButton.Click += new System.EventHandler(this.rbnbtnClose_Click);


//this.rbnbtnSave_Click --this the ribbon ok button click event
// this.rbnbtnClose_Click --this the ribbon Cancelbutton click event
 
Share this answer
 
Select the Menu which you want to assign shortcut.

right click on it and click on properties.

In the Text field, write the name of the menu which you want to show with '&' this sign before the character on which you want to make the shortcut.

ex : suppose you have a menu called file. and you want to make a shortcut key on f.
then : select the file menu - go to properties - in the text field set the menu name as
'&File' without ' sign. it will create the shortcut key with F.

when you want to see this shortcut in run time just press the ctrl (Control) button in keyboard. all the shortcuts key will be displayed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900