这个问题早就解决了:
以下程序可以将之前打印图纸时的打印机保存起来给下次打印其它图纸时用。- ' AutoPlotConfig.dvb
- ' 版权所有 (C) 1999-2003 明经通道 郑立楷
- '
- 'http://www.mjtd.com ; mccad@mjtd.com
- '
- ' 本软件免费可供进行任何用途需求的拷贝、修改及发行, 但请遵循下述原则:
- '
- ' 1) 上列的版权通告必须出现在每一份拷贝里。
- ' 2) 相关的说明文档也必须载有版权通告及本项许可通告。
- '
- ' 本软件仅提供作为应用上的参考, 而未声明或隐含任何保证; 对于任何特殊
- ' 用途之适应性, 以及商业销售所隐含作出的保证, 在此一概予以否认。Option Explicit
- Dim PrintName As String
- Dim BigLWeight As String
- Dim ConfigName As String
- Dim PStyleName As String
-
-
- '打印或页面设置开始前调用GetPrintName过程
- Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
- If CommandName = "PAGESETUP" Or CommandName = "PLOT" Then
- Call GetPrintName
- End If
- End Sub'打印或页面设置结束后调用SetPrintName过程
- Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
- If CommandName = "PAGESETUP" Or CommandName = "PLOT" Then
- Call SetPrintName
- End If
- End Sub'检查默认打印机选项,如果设置与默认选项不同,则更改过来
- Private Sub GetPrintName()
- PrintName = GetSetting("MCCAD", "DrawingSetting", "PrintName")
-
- If PrintName <> "" And ThisDrawing.ActiveLayout.ConfigName <> PrintName Then
- ThisDrawing.ActiveLayout.RefreshPlotDeviceInfo
- On Error Resume Next
- ThisDrawing.ActiveLayout.ConfigName = PrintName
- End If
- End Sub'保存默认打印机选项到注册表中
- Private Sub SetPrintName()
- If PrintName = "" Then
- SaveSetting "MCCAD", "DrawingSetting", "PrintName", ThisDrawing.ActiveLayout.ConfigName
- Else
- If ThisDrawing.ActiveLayout.ConfigName <> PrintName Then
- If MsgBox("是否将“" & ThisDrawing.ActiveLayout.ConfigName & "”打印机做为默认打印机?", vbYesNo) = vbYes Then
- SaveSetting "MCCAD", "DrawingSetting", "PrintName", ThisDrawing.ActiveLayout.ConfigName
- End If
- End If
- End If
- End Sub
|