简体   繁体   English

如何创建Visual Studio 2008菜单选项?

[英]How can I create a Visual Studio 2008 menu option?

I'm not sure if what I'm asking for qualifies as a full-fledged add-in, but here goes... 我不确定我要的内容是否符合完整的加载项,但是这里...

I'd like to put an option in one of the menus (Edit, perhaps) that gives me the opportunity to clean my text-- namely, sometimes in the course of business my quotation marks around strings wind up "slanted" instead of straight up and down, a consequence of cutting and pasting from outside sources. 我想在一个菜单(可能是“编辑”)中添加一个选项,使我有机会清理文本—即,有时在业务过程中,字符串周围的引号会变成“倾斜”,而不是直的。向上和向下,是从外部来源剪切和粘贴的结果。

It would be great to have a "clean quotes" option in VS that does a search and replace in the current document and puts in the correct quotes. 最好在VS中有一个“干净的引号”选项,该选项在当前文档中进行搜索和替换并放入正确的引号。 How might I go about doing this, and thanks for the advice. 我该怎么做呢,谢谢你的建议。

Are you saying you have different fonts in your code window? 您是说代码窗口中的字体不同吗? This doesn't happen to me. 我不会这样 I can't make this happen to me. 我无法做到这一点。 There is only one font for the code at a time. 一次只有一种字体用于代码。

Can you provide a concrete example? 你能提供一个具体的例子吗?

The easiest way to do this is under the Tools menu. 最简单的方法是在“工具”菜单下。 Click Tools->External Tools... You can specify any program you want using macros for the current directory/file etc. You will have to find/create the tool to do what you want, but it is pretty simple to add. 单击“工具”->“外部工具...”。您可以使用宏为当前目录/文件等指定所需的任何程序。您必须找到/创建该工具才能执行所需的操作,但是添加起来非常简单。 You can also go to the Tools->Customize... dialog to add a toolbar button or key binding. 您也可以转到“工具”->“自定义...”对话框来添加工具栏按钮或按键绑定。

For your particular problem you could very simply write a little command line to to fixup your file for you or use use something like sed . 对于您的特定问题,您可以非常简单地编写一个命令行来为您修复文件或使用sed之类的东西。

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

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