Visio 解决方案Visio solutions

Visual Studio 提供可用于创建 Microsoft Office Visio 的 VSTO 外接程序的项目模板。Visual Studio provides project templates you can use to create VSTO Add-ins for Microsoft Office Visio. VSTO 外接程序可用于自动运行 Visio、扩展 Visio 功能或自定义 Visio 用户界面 (UI)。You can use VSTO Add-ins to automate Visio, extend Visio features, or customize the Visio user interface (UI).

有关 VSTO 外接程序的详细信息,请参阅VSTO 外接程序编程入门Architecture of VSTO 外接程序。如果您不熟悉如何使用 Microsoft Office 编程,请参阅开始(Visual Studio 中的 Office 开发)For more information about VSTO Add-ins, see Get started programming VSTO Add-ins and Architecture of VSTO Add-ins. If you are new to programming with Microsoft Office, see Get started (Office development in Visual Studio).

适用于: 本主题中的信息适用于 Visio 2010 VSTO 外接程序项目。Applies to: The information in this topic applies to VSTO Add-in projects for Visio 2010. 有关详细信息,请参阅按 Office 应用程序和项目类型提供的功能For more information, see Features Available by Office Application and Project Type.

Note

开发扩展的 Office 体验跨解决方案是否有兴趣多个平台Interested in developing solutions that extend the Office experience across multiple platforms? 查看全新Office 外接程序模型Check out the new Office Add-ins model. Office 外接程序具有较小的需求量与 VSTO 外接程序和解决方案,相比,您可以使用几乎任何 web 编程技术,HTML5、 JavaScript、 CSS3 和 XML 等来生成。Office Add-ins have a small footprint compared to VSTO add-ins and solutions, and you can build them by using almost any web programming technology, such as HTML5, JavaScript, CSS3, and XML.

通过使用 Visio 对象模型实现 Visio 的自动化Automate Visio by using the Visio object model

Visio 对象模型公开了许多类,它们可用于自动运行 Visio 来创建针对组织结构图、流程图、项目时间线、网络图、办公区等关系图。The Visio object model exposes many classes that you can use to automate Visio to create diagrams for organizational charts, flowcharts, project timelines, network diagrams, office spaces, and more. 借助 API,你可以编写代码来完成常规任务:The API enables you to write code to accomplish common tasks:

  • 在关系图中构造并放置形状和文本。Construct and position shapes and text in diagrams.

  • 基于业务逻辑和用户输入管理形状行为。Manage shape behavior based on business logic and user input.

  • 控制关系图的可视化效果,如平移和缩放。Control diagram visualization such as panning and zooming.

  • 自定义应用程序 UI。Customize the application UI.

  • 将外部数据导入 Visio,将其链接到形状并在页面上以图形方式显示。Import external data into Visio, link it to shapes, and display it graphically on a page.

    可以查看分步过程和代码示例使用 Visio 对象模型处理文档和形状使用 Visio 文档使用 Visio 形状You can view step-by-step procedures and code examples for using the object model of Visio to work with documents and shapes in Work with Visio documents and Work with Visio shapes.

    若要从 VSTO 外接程序访问 Visio 对象模型,请使用项目中 Application 类的 ThisAddIn 字段。To access the Visio object model from a VSTO Add-in, use the Application field of the ThisAddIn class in your project. Application 字段返回 Microsoft.Office.Interop.Visio.Application 对象,该对象表示 Visio 的当前实例。The Application field returns a Microsoft.Office.Interop.Visio.Application object that represents the current instance of Visio. 有关详细信息,请参阅程序 VSTO 外接程序For more information, see Program VSTO Add-ins.

    调入 Visio 对象模型时,将使用 Visio 的主互操作程序集 (PIA) 中提供的类型。When you call into the Visio object model, you use types that are provided in the primary interop assembly (PIA) for Visio. 该 PIA 用作 VSTO 外接程序中的托管代码和 Visio 中的 COM 对象模型之间的桥梁。The PIA acts as a bridge between the managed code in the VSTO Add-in and the COM object model in Visio. Visio PIA 中的所有类型都在 Microsoft.Office.Interop.Visio 命名空间中进行定义。All types in the Visio PIA are defined in the Microsoft.Office.Interop.Visio namespace. 有关主互操作程序集的详细信息,请参阅Office 解决方案开发概述(VSTO) Office 主互操作程序集For more information about primary interop assemblies, see Office solutions development overview (VSTO) and Office primary interop assemblies.

Visio 对象模型概述Visio object model overview

您可以找到在 Visio 对象模型概述Visio 对象模型概述,其中包括指向 Visio 对象模型参考和 Sdk。You can find an overview of the Visio object model at Visio object model overview, which includes links to the Visio object model reference and the SDKs.

自定义 Visio 用户界面Customize the user interface of Visio

该 Visio UI 还拥有以下自定义选项。The Visio UI has the following customization options.

任务Task 更多相关信息For more information
自定义功能区。Customize the ribbon. 功能区概述Ribbon Overview

有关自定义 Visio UI 的信息,请参阅 Visio.UIObject 类的 VBA 参考文档。For information about customizing the UI of Visio, see the VBA reference documentation for the Visio.UIObject class.

请参阅See also