简体   繁体   English

如何绑定ctrl + 1来选择第一个标签?

[英]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? 如何绑定ctrl + 1以选择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. 如果您不确定我的意思,请尝试在Google Chrome中打开多个标签,然后尝试按Ctrl + 1,2,3在它们之间切换。

I also have ReSharper - if that helps. 我也有ReSharper - 如果有帮助的话。

Explore on Visual Studio Extension " Productivity Power Tool ", it already has this kind of tab navigation. 探索Visual Studio Extension“ Productivity Power Tool ”,它已经有了这种标签导航。

  • Activate a specific regular tab by Ctrl+Alt+Num Pad 1 through 0 按Ctrl + Alt + Num Pad 1到0激活特定的常规选项卡
  • Activate a specific pinned tab by Ctrl+Num Pad 1 through 0 通过Ctrl + Num Pad 1到0激活特定的固定选项卡

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

With ReSharper. 使用ReSharper。 Open your first tab, click anywhere in the text and press Ctrl+Shift+1 (or 2, 3, etc.) to place ReSharper's bookmark. 打开第一个选项卡,单击文本中的任意位置,然后按Ctrl + Shift + 1(或2,3等)放置ReSharper的书签。 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. 然后您可以打开此选项卡并按Ctrl + 1(2,3等)转到此书签,即使您打开了其他选项卡也是如此。 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. 我创建了一个菜单项(如果您正在使用WFA)并创建了名为like:tab0ToolStripMenuItem等的工具条菜单项。

I set the menu item visible property to False and each menu item to ShortcutKeys like Ctrl+1 我将菜单项visible属性设置为False ,将每个菜单项设置为ShortcutKeys,如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. 可能是一个穷人和新手的方式这样做,但它的工作原理,我希望这可以帮助你或任何其他人看这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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