yaoyu88 发表于 2006-6-29 16:57:00

不同图层的开关对连续打印无效,恳请各位大大帮忙。

<P>我已经将Backgroundplot变量设为0。源程序如下:</P>
<P>Private Sub CommandButton1_Click()<BR>&nbsp; Err.Clear<BR>&nbsp; On Error Resume Next<BR>&nbsp; Dim objlayer, shutdownobjlayer, layerObj As AcadLayer<BR>&nbsp; Dim layername, shutdownlayername, a As String</P>
<P><BR>&nbsp; For i = 0 To Listlayer2.ListCount - 1&nbsp; ' 把list2中的层都关掉<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; layername = Listlayer2.List(i)<BR>&nbsp;&nbsp;&nbsp; 'Set objlayer = ThisDrawing.Layers.Item(layername)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For j = 0 To Listlayer2.ListCount - 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shutdownlayername = Listlayer2.List(j)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set shutdownobjlayer = ThisDrawing.Layers.Item(shutdownlayername)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shutdownobjlayer.LayerOn = False<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If shutdownlayername = layername Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shutdownobjlayer.LayerOn = True '把要打印的层打开<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a = layername<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next j<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ThisDrawing.Application.Documents.ModelSpace.PlotType = acWindow<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set layerObj = ThisDrawing.Layers.Item(a)</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ThisDrawing.ActiveLayer = layerObj<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ThisDrawing.Plot.PlotToDevice '打印<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If MsgBox("现在正在打印的图层是" + a _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + ",先不要按确定,等打完了再按." + "如果发现打印格式不对,就按取消", _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vbOKCancel + vbInformation) = vbCancel Then Exit For</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next i</P>
<P>End Sub</P>
<P>恳请大大蒙帮忙。</P>

yaoyu88 发表于 2006-6-30 09:07:00

<P>问题解决了,加一个regen的语句就行了。</P>
页: [1]
查看完整版本: 不同图层的开关对连续打印无效,恳请各位大大帮忙。