Visual Studio 2017 extended development (3) bind shortcut keys to menu items, visual Studio

Source: Internet
Author: User

Visual Studio 2017 extended development (3) bind shortcut keys to menu items, visual Studio

How to map keyboard shortcuts to custom buttons, how to use shortcut keys to start the menu created by myself, confused at the beginning, found for a long time. It may also be because I didn't quite understand it at the beginning, and I will understand it later. It is actually very simple.

Many shortcut keys are already used in Visual studio. verify whether the shortcut keys you want to set can be used before confirming the shortcut keys. Of course, they cannot be repeated, right.

Verify that the shortcut key is used

Tools → options → environment, select the keyboard and enter the shortcut key you want to set. If the shortcut key has been used, the currently used object will be displayed.

Bind keyboard shortcuts

Open commandPackage. vsct

Add

  <KeyBindings>      <KeyBinding guid="guidCommandPackageCmdSet" id="CommandId" editor="guidVSStd97" key1="m" mod1="CONTROL" key2="n" mod2="CONTROL"/>    </KeyBindings>

Here I set the key combination, Ctrl + m, Ctrl + n, or you can directly Ctrl + a character, then remove key2 and mod2.

In most cases, it is best not to use Shift, because it may cause uppercase or lowercase letters.

Editor = "guidVSStd97" is used to make the command available in the visual studio compiler.

Guid is the name in Symbols. Here I am

<Symbols>
<! -- This is the package guid. -->

<GuidSymbol name = "guidCommandPackageCmdSet" value = "{0ea%e5-6e5d-420c-a89c-ad63d15d521a}">

</Symbols>

Therefore, the guid here is guidCommandPackageCmdSet.

The keyBinding id is the id of the Button you set.

<Button guid = "guidCommandPackageCmdSet" id = "CommandId" priority = "0x0100" type = "Button">

So the id is CommandId

 

This article is my learning record. If you have any questions, please comment below. repost the article to indicate the source.

If you have any help, please give me a thumbs up at the bottom right of the mouse. Your support is my greatest motivation.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.