VS.NET集成环境插件开发指南之操纵VS开发环境
[IT168 技术文档]一、 操纵VS开发环境
VS.NET自动化模型涉及的面太广,本文只针对一些专题加以说明。
1、 利用代码模型浏览代码
l 获取代码模型对象
//获取当前正活动的文档
![]()
Document activeDocument = applicationObject.ActiveDocument;
![]()
if(activeDocument != null)
![]()
...{
![]()
ProjectItem projectItem = activeDocument.ProjectItem;
![]()
if(projectItem != null)
![]()
...{
![]()
FileCodeModel fileCodeModel = projectItem.FileCodeModel;
![]()
if(fileCodeModel != null)
![]()
...{
![]()
CodeElements codeElements = fileCodeModel.CodeElements;
![]()
if(codeElements != null)
![]()
...{
![]()
foreach(CodeElement ce in codeElements)
![]()
...{
![]()
result.AddRange(getCodeElements(ce));
![]()
}
![]()
}
![]()
}
![]()
}
![]()
}
![]()
0
相关文章
