Can I programmatically export class diagrams from Visual Studio 2008?

落爺英雄遲暮 提交于 2020-01-04 09:18:32

问题


I can export a class diagram as an image from Visual Studio by right-clicking on the surface and choosing "Export Diagram as Image..."

Is there a way to do this through command line? I'd like to be able to generate all of my class diagrams as images so I can include it in the .chm I am building w/ Sandcastle.


回答1:


Found it after a full day of searching. In case anyone ever comes across this again:

Two ways to do this:

  1. Microsoft.VisualStudio.Modeling.Diagrams.Diagram.CreateBitmap() lets you pass in a collection of shapes and export them as a bitmap
  2. Microsoft.VisualStudio.EnterpriseTools.Shell.DiagramExporter is slightly more complicated, but lets you create your own implementation of IServiceProvider, then you can choose locations, file formats, etc.

Slightly more information is available in this MS forum.



来源:https://stackoverflow.com/questions/1540476/can-i-programmatically-export-class-diagrams-from-visual-studio-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!