Der*_*unk 21 printing visual-studio
有没有办法一次打印解决方案中的所有(*.cs)文件,也就是说,没有点击它们然后点击打印?
Dan*_*ant 10
从我从其他地方提出的类似问题中收集的内容来看,这个"功能"并没有构建到Visual Studio中.
但是看起来MSDN有一个宏可以用来打印你的所有代码 ; 也许你可以使用它,或类似的东西:
Sub PrintItemsInSelectedProject()
Dim proj As Project
Dim objProj As Object()
objProj = DTE.ActiveSolutionProjects
If objProj.Length = 0 Then
Exit Sub
End If
proj = DTE.ActiveSolutionProjects(0)
PrintItemsInSelectedProject(proj.ProjectItems)
End Sub
Private Sub PrintItemsInSelectedProject( _
ByVal projitems As ProjectItems)
Dim projitem As ProjectItem
For Each projitem In projitems
If (IsPrintableFile(projitem) = True) Then
If (projitem.IsOpen( _
EnvDTE.Constants.vsViewKindTextView)) Then
projitem.Document.PrintOut()
Else
Dim doc As Document
doc = projitem.Open( _
EnvDTE.Constants.vsViewKindTextView).Document
doc.PrintOut()
doc.Close(vsSaveChanges.vsSaveChangesNo)
End If
End If
PrintItemsInSelectedProject(projitem.ProjectItems)
Next
End Sub
Function IsPrintableFile( _
ByVal projItem As ProjectItem) As Boolean
Dim fileName As String
Dim extensions As _
New System.Collections.Specialized.StringCollection
' If you add a file to your project that is of
' a type that can be printed,
' then add the extension of that
' file type to this list.
Dim exts As String() = {".cs", ".vb", _
".aspx", ".xsd", ".xml", ".xslt", _
".config", ".htm", ".html", ".css", _
".js", ".vbs", ".wsf", ".txt", ".cpp", _
".c", ".h", ".idl", ".def", ".rgs", ".rc"}
extensions.AddRange(exts)
fileName = projItem.FileNames(1)
Return extensions.Contains( _
System.IO.Path.GetExtension(fileName).ToLower())
End Function
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27915 次 |
| 最近记录: |