如何在VS 2008中快速环绕HTML标记文本? [英] How to quickly surround text with HTML markup in VS 2008?

查看:170
本文介绍了如何在VS 2008中快速环绕HTML标记文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2008编辑器。例如,假设我有一个文本,我去了:有没有办法拿一段文本为例,突出显示它并使用快捷键来快速添加标记?商店,我想要加粗它,我必须键入< b>商店< / b> 。使用HTML编辑器只需按 Ctrl + 解决方案

使用普通的文本编辑器VS不提供内建内容,但是您可以添加自定义宏。

  Sub MakeSelectionBold()
DTE.ActiveDocument.Selection.Text = < b> 中+ DTE.ActiveDocument.Selection.Text +< / b>
End Sub

然后,您可以将它分配到快捷方式或添加按钮到您的工具栏。


I am working with Visual Studio 2008 editor. Is there a way to take a piece of text for example, highlight it and use shortcuts to quickly add markup?
For example, lets say I have a text, I went to: the store and I want to bold it, I have to type <b>the store</b>. Is there a quicker and easier way to do this?

解决方案

With HTML Editor just press Ctrl+B...

With regular text editor VS does not provide something build-in, but you can add custom macros. Something like the following will do job for you.

Sub MakeSelectionBold()
    DTE.ActiveDocument.Selection.Text = "<b>" + DTE.ActiveDocument.Selection.Text + "</b>"
End Sub

You can then assign it to the short-cut or add button to your toolbar.

这篇关于如何在VS 2008中快速环绕HTML标记文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆