Visual Studio CommandBar“名称”

发布于 2024-09-03 07:18:40 字数 406 浏览 5 评论 0原文

在 Visual Studio 2010 中,您可以创建的唯一选项是“菜单栏”上“工具”下的命令栏。在某些情况下,我想知道如何将命令栏放置在标准栏上,或者在右键单击项目文件时找到。

示例:

Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar =

((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.
CommandBars)["MenuBar"];

默认情况下它显示“MenuBar”,我确信还有其他内容,例如“Standard”。但是,我无法找到该列表的资源或文档,我想知道是否有人知道在哪里查找这些“名称”的列表。

提前谢谢你们了。

In Visual Studio 2010, the only option you can create is a commandbar under "Tools" on the "MenuBar". In some cases, I would want to know how to place the command bar on the standard bar, or be found when I right-click a project file.

Example:

Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar =

((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.
CommandBars)["MenuBar"];

By default it shows "MenuBar" and I am certain there is others, such as "Standard". However I am unable to find the resources or documentation for the list, and I wonder if anyone know where to look for list of these "Names".

Thank you guys in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

庆幸我还是我 2024-09-10 07:18:40

我在开发 Visual Studio 插件时需要解决这个问题。看起来这取决于您安装的内容。例如,我有一些可用的透明案例 CommandBar,因为我使用透明案例集成插件。我会说,更常见的是“代码窗口”、“项目”、“菜单栏”、“解决方案”和“项目”。要具体回答您的问题,您可以使用“标准”和“项目”命令栏。

要生成所有 CommandBar 的列表,您可以创建一个 Visual Studio 插件并将以下代码粘贴到 Connect.cs 中的 OnStartupComplete 中:

CommandBars commandBars = (CommandBars)_applicationObject.CommandBars;
StringBuilder sb = new StringBuilder();

foreach (CommandBar cbar in commandBars)
{
    sb.AppendLine(cbar.Name);
}

Clipboard.SetText(sb.ToString());

结果(超过 300 个):

MenuBar
Standard
Build
Context Menus
Data Design
Formatting
Style Application
HTML Source Editing
Class Designer Toolbar
Text Editor
Workflow
Dialog Editor
Image Editor
Style Sheet
Source Control
Recorder
Microsoft XML Editor
Query Designer
View Designer
Database Diagram
Table Designer
Layout
Help
Debug Location
Debug
Report Formatting
Report Borders
Device
Microsoft Office Excel 2007
Microsoft Office Excel 2003
Microsoft Office Word 2007
Microsoft Office Word 2003
Test Tools
CrystalReportMain
CrystalReportInsert
ClearCase - Base
ClearCase - UCM
Error List
Docked Window
Menu Designer
Properties Window
Toolbox
Task List
Results List
Stub Project
No Commands Available
Command Window
AutoHidden Windows
Expansion Manager
Find Regular Expression Builder
Replace Regular Expression Builder
Wild Card Expression Builder
Wild Card Expression Builder
External Tools Arguments
External Tools Directories
Easy MDI Tool Window
Easy MDI Document Window
Easy MDI Dragging
Open Drop Down
Object Browser Objects Pane
Object Browser Members Pane
Object Browser Description Pane
Find Symbol
Drag and Drop
Bookmark Window
Error Correction
EzMDI Files
Ca&ll Browser
Preview Changes
Discover Service References
Smart Tag
Editor Context Menus
Class View Context Menus
Debugger Context Menus
Project and Solution Context Menus
Other Context Menus
Sort By
Show Columns
Implement Interface
Resolve
Refactor
Organize Usings
Create Private Accessor
Class View Multi-select Project references Items
Class View Multi-select Project references members
Class View Project
Class View Item
Class View Folder
Class View Grouping Folder
Class View Multi-select
Class View Multi-select members
Class View Member
Class View Grouping Members
Class View Project References Folder
Class View Project Reference
Class View Project Reference Item
Class View Project Reference Member
Project
Solution Folder
Cross Project Solution Project
Cross Project Solution Item
Cross Project Project Item
Cross Project Multi Project
Cross Project Multi Item
Cross Project Multi Solution Folder
Cross Project Multi Project/Folder
Item
Folder
Reference Root
Reference Item
Web Reference Folder
App Designer Folder
Web Project Folder
Web Folder
Web Item
Web SubWeb
References
Misc Files Project
Solution
Code Window
XAML Editor
Surface
DataSourceContext
DbTableContext
DataTableContext
RelationContext
FunctionContext
ColumnContext
QueryContext
DataAccessorContext
Context
Basic Context
Context
Context
Context
HTML Context
Script Context
ASPX Context
ASAX Context
ASPX Code Context
ASAX Code Context
ASPX VB Code Context
ASAX VB Code Context
ASMX Code Context
ASMX VB Code Context
Change &View
Static Node
Object Node
Multiple Static Nodes
Multiple Homogenous Object Nodes
Multiple Heterogenous Object Nodes
Multiple Heterogenous Nodes
Add &New
Selection
Container
TraySelection
Document Outline
Component Tray
Propertysheet
Configuration
Project
Multi-Select
System Propertysheet
Topic Menu
Topic Source Menu
Favorites Window Context Menu
Data Sources
Server Explorer
Managed Resources Editor Context Menu
Settings Designer
My Extensibility
Class Designer Context Menu
Class Diagram Context Menu
Class Details Context Menu
Selection
&Zoom
Page Layout
Designer Actions
&Navigation Tools
Resource View
Resource Editors
Resource Dialog Editors
Binary Editor
CSSDocOutline
CSSSource
Checkin Dialog Context Menu
Pending Checkin Window Context Menu
Standard TreeGrid context menu
GetVersion Dialog Context Menu
Check Out Dialog Context Menu
Macro
Module
Project
Root
TocContext
ResListContext
Query Diagram Pane
Query Diagram Table
Query Diagram Table Column
Query Diagram Join Line
Query Diagram Multi-select
Query Grid Pane
Query SQL Pane
Query Results Pane
Database Designer
Database Designer Table
Database Designer Relationship
Text Annotation
Database Project
DB Project Connection
DB Project Folder
Database References Folder
Folders
DB Project File
Query
Script
Database Reference Node
Files
Multi-select
PropertyBrowser
Editor
Script Outline
DefaultContext
ImageContext
SelectionContext
AnchorContext
Step Into Specific
Autos Window
Breakpoint
Load Symbols From
Breakpoints Window
Call Stack Window
Thread Tip Window
Data Tip Window
Disassembly Window
Locals Window
Memory Window
Modules Window
Output Window
Processes Window
Registers Window
Threads Window
Watch Window
Script Project
Thread IP Marker
Thread IP Markers
Control
Report
Row/Column
Cell
Field Chooser
Row/Column
Chart
Registry
File System
File System
File Types
User Interface
Launch Conditions
Custom Actions
New
Add
Add Special Folder
View
Project Node
A&dd
Cab Project Node
A&dd
File nodes
Dep. file nodes
Assembly nodes
Dep. assembly nodes
MSM nodes
Dep. MSM nodes
Output nodes
Simple file nodes
Simple output nodes
Dependency node
Multiple selections
Dep. Multiple selections
View
Editor
ORDesigner Context Menu
ORDesigner Context Menu
ORDesigner Context Menu
OTBObjCtxtMenu
SIDE Left Pane Context Menu
SIDE CertMgr Context Menu
Registry
File System
File System
New
Add
Add Special Folder
View
Project Node
A&dd
Cab Project Node
A&dd
File nodes
Dep. file nodes
Assembly nodes
Dep. assembly nodes
MSM nodes
Dep. MSM nodes
Output nodes
Dependency node
Multiple selections
Dep. Multiple selections
View
AppNet Designer Context
AppNet Project Node Context
Exe Project
Debug
Test Results Context Menu
Test List Editor Context Menu
Test List Context Menu
Test Run Context Menu
View Context Menu
Group
Database
Edit Text
Formula Parameter
Section
Default
Object Selection
Insert to Report
SchemaExplorer
AddNewItem
MicrosoftDataEntityDesign Context
MicrosoftDataEntityDesign Context
Find Checkouts
Pending Solution Checkins
Views Folder item context menu
UCM Project item context menu
View item context menu
Solution item context menu
Deliver
Rebase
ClearCase search Context Menus
System

I needed to figure this out while working on a visual studio plug-in. It looks like it depends on what you have installed. For example, I have some clear case CommandBars available to me because I work with the clear case integration plug-in. I'll echo that the more common ones are "Code Window", "Project", "MenuBar", "Solution", and "Item". To specifically answer your question, you would use the "Standard" and "Project" command bars.

To generate a list of all CommandBars you can create a visual studio plug-in and paste the following code into OnStartupComplete in Connect.cs:

CommandBars commandBars = (CommandBars)_applicationObject.CommandBars;
StringBuilder sb = new StringBuilder();

foreach (CommandBar cbar in commandBars)
{
    sb.AppendLine(cbar.Name);
}

Clipboard.SetText(sb.ToString());

Results (over 300):

MenuBar
Standard
Build
Context Menus
Data Design
Formatting
Style Application
HTML Source Editing
Class Designer Toolbar
Text Editor
Workflow
Dialog Editor
Image Editor
Style Sheet
Source Control
Recorder
Microsoft XML Editor
Query Designer
View Designer
Database Diagram
Table Designer
Layout
Help
Debug Location
Debug
Report Formatting
Report Borders
Device
Microsoft Office Excel 2007
Microsoft Office Excel 2003
Microsoft Office Word 2007
Microsoft Office Word 2003
Test Tools
CrystalReportMain
CrystalReportInsert
ClearCase - Base
ClearCase - UCM
Error List
Docked Window
Menu Designer
Properties Window
Toolbox
Task List
Results List
Stub Project
No Commands Available
Command Window
AutoHidden Windows
Expansion Manager
Find Regular Expression Builder
Replace Regular Expression Builder
Wild Card Expression Builder
Wild Card Expression Builder
External Tools Arguments
External Tools Directories
Easy MDI Tool Window
Easy MDI Document Window
Easy MDI Dragging
Open Drop Down
Object Browser Objects Pane
Object Browser Members Pane
Object Browser Description Pane
Find Symbol
Drag and Drop
Bookmark Window
Error Correction
EzMDI Files
Ca&ll Browser
Preview Changes
Discover Service References
Smart Tag
Editor Context Menus
Class View Context Menus
Debugger Context Menus
Project and Solution Context Menus
Other Context Menus
Sort By
Show Columns
Implement Interface
Resolve
Refactor
Organize Usings
Create Private Accessor
Class View Multi-select Project references Items
Class View Multi-select Project references members
Class View Project
Class View Item
Class View Folder
Class View Grouping Folder
Class View Multi-select
Class View Multi-select members
Class View Member
Class View Grouping Members
Class View Project References Folder
Class View Project Reference
Class View Project Reference Item
Class View Project Reference Member
Project
Solution Folder
Cross Project Solution Project
Cross Project Solution Item
Cross Project Project Item
Cross Project Multi Project
Cross Project Multi Item
Cross Project Multi Solution Folder
Cross Project Multi Project/Folder
Item
Folder
Reference Root
Reference Item
Web Reference Folder
App Designer Folder
Web Project Folder
Web Folder
Web Item
Web SubWeb
References
Misc Files Project
Solution
Code Window
XAML Editor
Surface
DataSourceContext
DbTableContext
DataTableContext
RelationContext
FunctionContext
ColumnContext
QueryContext
DataAccessorContext
Context
Basic Context
Context
Context
Context
HTML Context
Script Context
ASPX Context
ASAX Context
ASPX Code Context
ASAX Code Context
ASPX VB Code Context
ASAX VB Code Context
ASMX Code Context
ASMX VB Code Context
Change &View
Static Node
Object Node
Multiple Static Nodes
Multiple Homogenous Object Nodes
Multiple Heterogenous Object Nodes
Multiple Heterogenous Nodes
Add &New
Selection
Container
TraySelection
Document Outline
Component Tray
Propertysheet
Configuration
Project
Multi-Select
System Propertysheet
Topic Menu
Topic Source Menu
Favorites Window Context Menu
Data Sources
Server Explorer
Managed Resources Editor Context Menu
Settings Designer
My Extensibility
Class Designer Context Menu
Class Diagram Context Menu
Class Details Context Menu
Selection
&Zoom
Page Layout
Designer Actions
&Navigation Tools
Resource View
Resource Editors
Resource Dialog Editors
Binary Editor
CSSDocOutline
CSSSource
Checkin Dialog Context Menu
Pending Checkin Window Context Menu
Standard TreeGrid context menu
GetVersion Dialog Context Menu
Check Out Dialog Context Menu
Macro
Module
Project
Root
TocContext
ResListContext
Query Diagram Pane
Query Diagram Table
Query Diagram Table Column
Query Diagram Join Line
Query Diagram Multi-select
Query Grid Pane
Query SQL Pane
Query Results Pane
Database Designer
Database Designer Table
Database Designer Relationship
Text Annotation
Database Project
DB Project Connection
DB Project Folder
Database References Folder
Folders
DB Project File
Query
Script
Database Reference Node
Files
Multi-select
PropertyBrowser
Editor
Script Outline
DefaultContext
ImageContext
SelectionContext
AnchorContext
Step Into Specific
Autos Window
Breakpoint
Load Symbols From
Breakpoints Window
Call Stack Window
Thread Tip Window
Data Tip Window
Disassembly Window
Locals Window
Memory Window
Modules Window
Output Window
Processes Window
Registers Window
Threads Window
Watch Window
Script Project
Thread IP Marker
Thread IP Markers
Control
Report
Row/Column
Cell
Field Chooser
Row/Column
Chart
Registry
File System
File System
File Types
User Interface
Launch Conditions
Custom Actions
New
Add
Add Special Folder
View
Project Node
A&dd
Cab Project Node
A&dd
File nodes
Dep. file nodes
Assembly nodes
Dep. assembly nodes
MSM nodes
Dep. MSM nodes
Output nodes
Simple file nodes
Simple output nodes
Dependency node
Multiple selections
Dep. Multiple selections
View
Editor
ORDesigner Context Menu
ORDesigner Context Menu
ORDesigner Context Menu
OTBObjCtxtMenu
SIDE Left Pane Context Menu
SIDE CertMgr Context Menu
Registry
File System
File System
New
Add
Add Special Folder
View
Project Node
A&dd
Cab Project Node
A&dd
File nodes
Dep. file nodes
Assembly nodes
Dep. assembly nodes
MSM nodes
Dep. MSM nodes
Output nodes
Dependency node
Multiple selections
Dep. Multiple selections
View
AppNet Designer Context
AppNet Project Node Context
Exe Project
Debug
Test Results Context Menu
Test List Editor Context Menu
Test List Context Menu
Test Run Context Menu
View Context Menu
Group
Database
Edit Text
Formula Parameter
Section
Default
Object Selection
Insert to Report
SchemaExplorer
AddNewItem
MicrosoftDataEntityDesign Context
MicrosoftDataEntityDesign Context
Find Checkouts
Pending Solution Checkins
Views Folder item context menu
UCM Project item context menu
View item context menu
Solution item context menu
Deliver
Rebase
ClearCase search Context Menus
System
梦魇绽荼蘼 2024-09-10 07:18:40

我只知道几个,而且我也很想知道这一点,因为我想知道asp.net中html代码窗口的名称。

但以下是我所知道的:
“代码窗口”(右键代码菜单)
“工具”
“菜单栏”
“标准”

编辑:您还可以放置一个 for 循环来查看命令栏名称。 (枚举)

I only know of a few, and I am too wondering this, since I would like to know the name of the html code window in asp.net.

but here are the ones I know:
"Code Window" (right-click code menu)
"Tools"
"MenuBar"
"Standard"

EDIT: Also you can put a for loop to look through the commandbar names. (enumeration)

浅忆 2024-09-10 07:18:40

我认为你可以通过枚举获取所有命令栏:CommandBars.GetEnumerator

I think you can get all commandbars by enumerate : CommandBars.GetEnumerator

稚气少女 2024-09-10 07:18:40

要查找特殊命令栏的名称,这对我很有帮助。
只需在 OnConnection() 中实现即可:

CommandBars cmdBars = (CommandBars)applicationObject.CommandBars;    
if (createCommand != null)
{
    for (int i = 0; i <= cmdBars.Count; i++)
    {
        try
        {
            Type curType = cmdBars[i].GetType();
            CommandBar commBarProject = cmdBars[i];    
            if (commBarProject != null)
            {
                creatorButton = (CommandBarButton)createCommand.AddControl(
                                commBarProject, commBarProject.Controls.Count + 1);
                creatorButton.Caption = "ViewModel - " + cmdBars[i].Name;
            }
        }
        catch (Exception){}
    }
}

每次右键单击您都会获得名称。

To find the name of a special command bar, this helps me very well.
Just implement into the OnConnection():

CommandBars cmdBars = (CommandBars)applicationObject.CommandBars;    
if (createCommand != null)
{
    for (int i = 0; i <= cmdBars.Count; i++)
    {
        try
        {
            Type curType = cmdBars[i].GetType();
            CommandBar commBarProject = cmdBars[i];    
            if (commBarProject != null)
            {
                creatorButton = (CommandBarButton)createCommand.AddControl(
                                commBarProject, commBarProject.Controls.Count + 1);
                creatorButton.Caption = "ViewModel - " + cmdBars[i].Name;
            }
        }
        catch (Exception){}
    }
}

With every right click you will get the name.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文