VS Extension: Create a txt file and set the content
使用 Visual Studio Extension 创建一个文本文件,并填入内容。
需要引用 EnvDTE
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\EnvDTE.dll
代码如下:
using System;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop; using EnvDTE; namespace CreateTextView
{
public static class CreateNew
{
public static void TextFile(string title, string fileContents)
{
DTE dte = (DTE)Package.GetGlobalService(typeof(DTE));
Window win = dte.ItemOperations.NewFile("General\\Text File", title, EnvDTE.Constants.vsViewKindTextView); TextSelection txtSel = (TextSelection)dte.ActiveDocument.Selection;
TextDocument txtDoc = (TextDocument)dte.ActiveDocument.Object(""); txtSel.SelectAll();
txtSel.Delete();
txtSel.Insert(fileContents);
txtSel.GotoLine();
}
}
}
在做Visual Studio 的插件时,使用自带的文本显示大文件快而且稳定。
使用RichTextBox显示大文件容易卡死。
VS Extension: Create a txt file and set the content的更多相关文章
- 解决: org.iq80.leveldb.DBException: IO error: C:\data\trie\000945.sst: Could not create random access file.
以太坊MPT树的持久化层是采用了leveldb数据库,然而在抽取MPT树代码运行过程中,进行get和write操作时却发生了错误: Caused by: org.fusesource.leveldbj ...
- sqlplus链接数据库报ORA-09925: Unable to create audit trail file
[localhost.localdomain]:[/oracle11/app/oracle11/product/11.2.0/dbhome_1/dbs]$ sqlplus / as sysdba SQ ...
- Can't create/write to file '/tmp/#sql_887d_0.MYD' (Errcode: 17)
lsof |grep "#sql_887d_0.MYD" 如果没有被占用就可以删掉 . https://wordpress.org/support/topic/cant-creat ...
- ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_909_0.MYI' (Errcode: 13)
mysql> desc tablename; ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_909_0.MYI' (Errcode ...
- Can't create/write to file '/tmp/#sql_3105_0.MYI' (Errcode: 13)
最近的项目中由于临时存储空间太大了.索性把tmp目录删除了.结果访问出现 Can't create/write to file '/tmp/#sql_3105_0.MYI' (Errcode: 13) ...
- [问题解决] initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock
错误: 在linux下开启mongoDB的 $ >bin: ./mongod 时报错:initAndListen: 10309 Unable to create/open lock file: ...
- How do I create a zip file?(转)
Creating a zip file is a task that can easily be accomplished by using the classes ZipOutputStream a ...
- OUI-67076 : OracleHomeInventory was not able to create a lock file" in Unix
Symptoms The command "opatch lsinventory" reports the error: OUI-67076:OracleHomeInventory ...
- How to create a zip file in NetSuite SuiteScript 2.0 如何在现有SuiteScript中创建和下载ZIP压缩文档
Background We all knows that: NetSuite filecabinet provided a feature to download a folder to a zip ...
随机推荐
- 利用JS_SDK实现QQ第三方登录
前言 现如今,第三方登录已成为大部分网站必备的一项基础技能,引入时髦的第三方登录不仅能帮你吸引更多的用户,也让你的网站可以充分利用其他大型网站的用户资源.本次教程将让你的网站最快捷便利地引入QQ登录. ...
- 关于Eclipse中的egit的常规使用和模板
修改bug的模板 要提交的comment信息.TDI-31426 fix bug: if get studio license use : Import License :after get lice ...
- Java基础环境搭建
- jQuery Easy UI 使用
一.引入必要文件 二.加载UI组件的方式 加载 UI 组件有两种方式: 1.使用 class 方式加载: 2.使用 JS 调用加载.//使用 class 加载,格式为: easyui-组件名 效果: ...
- Opencv——彩色图像灰度化的三种算法
为了加快处理速度在图像处理算法中,往往需要把彩色图像转换为灰度图像.24为彩色图像每个像素用3个字节表示,每个字节对应着RGB分量的亮度. 当RGB分量值不同时,表现为彩色图像:当RGB分量相同时,变 ...
- sqlserver 变量
变量:分为全局变量和局部变量全部变量:以@@声明,为系统变量,所有实例都能访问,用户只能访问,不能赋值局部变量:生命周期只在一个批处理内有效, 局部变量经常使用的三种用途:1 在循环语句中记录循环的次 ...
- Generate GUID using vbscript
在 .msi 中 的 Component table,查看 ComponentId 列,是一个16进制数的字符串, 用 InstallShield IDE 添加一个 component ,Compon ...
- jquery ajax php+mysql 无刷新分页 详细实例
最近在接触jquery和ajax,当前项目也会用到分页,为了用户体验更好一些,就准备用无刷新分页,这个demo很适合新手学习查看,写的比较清晰,话不多说,直接上代码吧. 首先是html页面,index ...
- WCF学习笔记(基于REST规则方式)
一.WCF的定义 WCF是.NET 3.0后开始引入的新技术,意为基于windows平台的通讯服务. 首先在学习WCF之前,我们也知道他其实是加强版的一个面向服务(SOA)的框架技术. 如果熟悉Web ...
- opengl Test
LIBS += -lGL -lGLU -lglut -lGLEW #include <GL/glut.h> #include <iostream> using namespac ...