霹雳啪啦啦 发表于 2008-12-2 15:05:00

XUXT:<br/>这个东东写过几年了,偶尔上来看看又被翻出来了。当年怎么写的忘记了,反正都是在MODELSPACE里操作的,没有布局的问题。<br/>贴出当年写的东东的核心子程序,供有兴趣的人参考。2006里调试正常。<br/><br/>Sub Plot_Frame(PlotZone() As Double)<br/><br/>Dim M, N As Integer<br/>Dim ExtLowLeft As Variant<br/>Dim ExtUpRight As Variant<br/>Dim PlotLowLeft(0 To 1) As Double, PlotUpRight(0 To 1) As Double<br/>                <br/>    If PlotRagType = acWindow Then<br/>        PlotLowLeft(0) = PlotZone(1)<br/>        PlotLowLeft(1) = PlotZone(2)<br/>        PlotUpRight(0) = PlotZone(3)<br/>        PlotUpRight(1) = PlotZone(4)<br/>        <br/>        ' 设置打印范围和打印区域的比例<br/>        ThisDrawing.ModelSpace.Layout.SetWindowToPlot PlotLowLeft, PlotUpRight<br/>        ElseIf PlotRagType = acExtents Then<br/>        <br/>            ExtLowLeft = ThisDrawing.GetVariable("extmin")<br/>            ExtUpRight = ThisDrawing.GetVariable("extmax")<br/>            PlotLowLeft(0) = ExtLowLeft(0)<br/>            PlotLowLeft(1) = ExtLowLeft(1)<br/>            PlotUpRight(0) = ExtUpRight(0)<br/>            PlotUpRight(1) = ExtUpRight(1)<br/>        <br/>    End If<br/>    ThisDrawing.ModelSpace.Layout.PlotType = PlotRagType<br/>    <br/>    ThisDrawing.ModelSpace.Layout.StandardScale = acScaleToFit<br/>    ThisDrawing.ModelSpace.Layout.CenterPlot = True<br/>    ThisDrawing.ModelSpace.Layout.StyleSheet = "monochrome.ctb"<br/>    <br/>    '选择打印机<br/>    ThisDrawing.ModelSpace.Layout.ConfigName = ComboBox1.Value<br/>    <br/>    '选择纸张<br/>    If OptionButton1.Value = True Then<br/>        ThisDrawing.ModelSpace.Layout.CanonicalMediaName = "A4"<br/>        ElseIf OptionButton2.Value = True Then<br/>            ThisDrawing.ModelSpace.Layout.CanonicalMediaName = "A3"<br/>    End If<br/>    <br/>    ' 设置打印份数为1<br/>    ThisDrawing.Plot.NumberOfCopies = 1<br/>    <br/>    ' 开始打印<br/>    ThisDrawing.Plot.QuietErrorMode = True<br/>    <br/>    '旋转设置<br/>    If PlotUpRight(0) - PlotLowLeft(0) &gt; PlotUpRight(1) - PlotLowLeft(1) Then<br/>        ThisDrawing.ModelSpace.Layout.PlotRotation = ac90degrees<br/>        Else<br/>            ThisDrawing.ModelSpace.Layout.PlotRotation = ac0degrees<br/>    End If<br/>    <br/>    ThisDrawing.Plot.PlotToDevice<br/>    DoEvents<br/>    <br/>End Sub<br/><br/>PlotZone是传递给子程序的打印区域,4元素数组,代表左上角和右下角的坐标。<br/>PlotRagType是全局变量,AcPlotType类型,代表是窗口还是范围等打印方式。<br/>ComboBox1中是打印机列表,可通过以下代码在父程序初始化时取得:<br/>plotDevices = ThisDrawing.ModelSpace.Layout.GetPlotDeviceNames()<br/>For I = LBound(plotDevices) To UBound(plotDevices)<br/>    ComboBox1.AddItem plotDevices(I)<br/>Next<br/>OptionButton1和2用来选择a4还是a3纸。<br/>你需要添加父程序,取得打印范围的左上交和右下角,然后一次次调用这个子程序,就可以批量打印了<br/>
页: 1 [2]
查看完整版本: 关于连续打印的问题,请教!!