简体   繁体   中英

How can I bind ctrl+1 to select first tab?

How can I bind ctrl+1 to select the first tab in Visual Studio 2010?

If you are unsure of what I mean, try having multiple tabs open in Google Chrome and try ctrl+1,2,3 to switch between them.

I also have ReSharper - if that helps.

Explore on Visual Studio Extension " Productivity Power Tool ", it already has this kind of tab navigation.

  • Activate a specific regular tab by Ctrl+Alt+Num Pad 1 through 0
  • Activate a specific pinned tab by Ctrl+Num Pad 1 through 0

http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/

With ReSharper. Open your first tab, click anywhere in the text and press Ctrl+Shift+1 (or 2, 3, etc.) to place ReSharper's bookmark. Then you can open this tab and go to this bookmark by pressing Ctrl+1 (2, 3, etc) even if you have other tab open. Exactly as you want.

I know this is a late response but I did this in a way without using an extension.

I created a menu item (if you're using WFA) and created tool strip menu items named like: tab0ToolStripMenuItem ect.

I set the menu item visible property to False and each menu item to ShortcutKeys like Ctrl+1

Then tided the click events to:

private void tab0ToolStripMenuItem_Click(object sender, EventArgs e)
{
    this.tabControl1.SelectedIndex = 0;
}

private void tab1ToolStripMenuItem_Click(object sender, EventArgs e)
{
    this.tabControl1.SelectedIndex = 1;
}

private void tab2ToolStripMenuItem_Click(object sender, EventArgs e)
{
    this.tabControl1.SelectedIndex = 2;
}

private void tab3ToolStripMenuItem_Click(object sender, EventArgs e)
{
    this.tabControl1.SelectedIndex = 3;
}

Probably a poor and newbie way of doing this but it works, I hope this helps you or anyone else looking to this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM