在Visual Studio 2010中使用自定义UI编辑器注册自定义文件类型 [英] Register custom file type with custom UI editor in Visual Studio 2010

查看:160
本文介绍了在Visual Studio 2010中使用自定义UI编辑器注册自定义文件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了名为 LearnVSXNow 的旧文章,并找到了 VSXtra ,该项目是为 Visual Studio 2008 编写的.

I found old article called LearnVSXNow and part #30 - Custom Editors in Visual Studio. There is sample project The Blog Item Editor which shows how to make custom file type assigned with custom UI editor for this file type extension (.blit) This sample uses project VSXtra, which is written for Visual Studio 2008.

有人可以为我指出一些有关 Visual Studio 2010 的教程,操作方法或方法吗?我的目标是在Visual Studio 2010中注册自定义文件类型扩展名(例如* .myext1),并分配我自己的自定义UI设计器(WinForms,从UserControl派生)以可视方式处理此类文件的内容.

Can someone point me to some tutorial, how-to, or something how to do the same for Visual Studio 2010 ? My goal is to register custom file type extension (e.g. *.myext1) within visual studio 2010, and assign my own custom UI designer (WinForms, derived from UserControl) to handle editing content of such file visually.

我找到了一些示例,但是每个示例仅显示了代码文本编辑器上的更改(突出显示一些单词等).但是我想显示我自己的工具窗口,其中包含我的用户控件.

I found some samples, but each of that shows only changes on code text editor (highlight some words, etc). But i want to show my own toolwindow with my usercontrol within it.

PS:使用我自己的usercontrol创建自定义工具窗口的一部分不是问题,我使用 VSPackage Builder项目模板以在visx中进行构建和注册.我的问题是如何注册自定义文件类型以使用此自定义工具窗口来编辑文件.

PS: Part of creating custom toolwindow with my own usercontrol within it is not problem, i use VSPackage Builder Project Template to build and register it within visx. My problem is how to register custom file type to use this custom toolwindow to edit file.

推荐答案

在Visual Studio 2010(注册和提供自定义编辑器的通用基础结构)中,核心文本编辑器发生了显着变化(几乎完全重写,围绕MEF设计). /designers并没有改变.

While the core text editor changed significantly (nearly a total re-write, designed around MEF) in Visual Studio 2010, the general infrastructure for registering and supplying custom editors/designers did not change.

MSDN上的创建自定义文本编辑器和设计器" 页是一个很好的起点.您还应该能够通过VSPackage向导并选择自定义编辑器"以使用基本的编辑器.它将为您提供一个简单的RTF编辑器.

The 'Creating Custom Text Editors and Designers' page on MSDN is a good place to start. You should also be able to go through the VSPackage wizard and choose "Custom Editor" to get a basic editor in place. It will give you a simple RTF editor.

您还可以在MSDN代码库中查看以下示例,以获取更多想法和启发:

You can also check out these samples on the MSDN Code Gallery for more ideas and inspiration:

  • Editor with Toolbox Support
  • Designer View Over XML Editor

通常建议将编辑器放在文档窗口(而不是工具窗口)中.这是几乎所有内置编辑器/设计器都在Visual Studio中使用的范例,这是用户从解决方案资源管理器中打开某些内容时所期望的.在ToolWindow中编辑内容可能会感觉不自然.

It is usually recommended that editors reside in a document window (as opposed to a tool window). This is the paradigm that nearly all the built-in editors/designers use in Visual Studio, and it's what users expect when opening something from Solution Explorer. Editing things in a ToolWindow can feel a bit unnatural.

我的理解是,VSXtra提供了一些附加的帮助程序/基类(超出Microsoft支持的范围),以简化各种任务(例如编写自定义编辑器/设计器).不过,绝对不需要创建自定义编辑器.

My understanding is that VSXtra provides some additional helper/base classes (beyond what Microsoft supports) to make various tasks (like writing a custom editor/designer) simpler. It is by no means required to create a custom editor though.

这篇关于在Visual Studio 2010中使用自定义UI编辑器注册自定义文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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