We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set shortcut key of XPToolbar baritem other custom key combination?

Thread ID:





69517 Oct 31,2007 08:26 AM UTC Oct 31,2007 09:46 AM UTC WinForms 1
Tags: Tools
Jonas Pettersson
Asked On October 31, 2007 08:26 AM UTC

I've got a baritem that uses the home key as its shortcut.

Since the home key is not present in System.Windows.Forms.Shortcut I've done this in the code on the key press event.

This works but the problem arises when I want to show the user that Home is the shortcut of the baritem.

I tried setting the baritem text to "Whatever\tCtrl+Home" like you did in C++/MFC but the \t escape sequence is a regular tab in the baritem control.

How can I achieve this?

Is there a way to set the Shortcut property of the baritem to be Home or some other key combination that is not part of System.Windows.Forms.Shortcut?

This would be ideal of course. It not possible, is there any way to fake the Ctrl+Home text in the shortcut column of the menu item text and tooltip?

Currently using but will upgrade to the latest 5.2 version this week. Using VS2005 SP1.

Kind regards

Jonas Pettersson
Replied On October 31, 2007 09:46 AM UTC

I found a solution for this, which is not supported by the designer so do it in such a place that it is not executed by the designer.

The predefined Shortcuts enum values are simply combinations of Keys enum values.

You can make your own combination as follows:

myBarItem.Shortcut = (Shortcut)(Keys.Shift | Keys.Home);



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon