现在看清楚了,你需要的是将所有布局改过来,而该程序只是将当前布局改过来,那程序要改一下了。
- Option Explicit
- Dim PrintName 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 <> "" Then
- Dim i As Integer
- For i = 0 To ThisDrawing.Layouts.Count - 1
- If ThisDrawing.Layouts(i).ConfigName <> PrintName Then
- ThisDrawing.Layouts(i).RefreshPlotDeviceInfo
- ThisDrawing.Layouts(i).ConfigName = PrintName
- End If
- Next
- 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
|