cad打印代码(2)

2019-09-01 11:09

If chkOnlyPlotThis.Value Then '清除列表框中所有元素 lstPlotFiles.Clear '获得当前图形名

Dim strTemp As String

strTemp = ThisDrawing.Application.ActiveDocument.Path & \& ThisDrawing.Application.ActiveDocument.name '向列表框添加当前图形

lstPlotFiles.AddItem strTemp cmdBrowse.Enabled = False cmdAdd.Enabled = False cmdAddAll.Enabled = False cmdClear.Enabled = False cmdClearAll.Enabled = False lstCurFiles.Enabled = False lstPlotFiles.Enabled = False Else

cmdBrowse.Enabled = True cmdAdd.Enabled = True cmdAddAll.Enabled = True cmdClear.Enabled = True cmdClearAll.Enabled = True lstCurFiles.Enabled = True lstPlotFiles.Enabled = True End If

End Sub

Private Sub chkPlotHidden_Change() '设置是否隐藏图纸空间对象

If Not objPlotConfiguration.ModelType Then _

objPlotConfiguration.PlotHidden = chkPlotHidden.Value End Sub

Private Sub chkPlotToFile_Change() '设置“打印到文件”组各控件激活状态 If chkPlotToFile.Value Then lbPlotPath.Enabled = True cboPlotPath.Enabled = True cmdBrowse2.Enabled = True Else

lbPlotPath.Enabled = False cboPlotPath.Enabled = False cmdBrowse2.Enabled = False

End If End Sub

Private Sub chkPlotWithLineweights_Change() '设置是否打印对象线宽

If Not chkPlotWithPlotStyles.Value Then _ objPlotConfiguration.PlotWithLineweights = chkPlotWithLineweights.Value End Sub

Private Sub chkPlotWithPlotStyles_Change() '设置是否应用打印样式

objPlotConfiguration.PlotWithPlotStyles = chkPlotWithPlotStyles.Value chkPlotWithLineweights.Enabled = Not (chkPlotWithPlotStyles.Value) End Sub

Private Sub chkReverse_Click() '设置图纸打印方向

Call PaperRotationChange End Sub

Private Sub cmdAdd_Click() '如果列表框中未存在任何元素

If lstCurFiles.ListCount = 0 Then

MsgBox \请先向列表框中添加文件!\ Exit Sub End If

Dim strFlies As String Dim i As Integer Dim n As Integer n = 0

'将上面列表框中选中的对象添加到下面的列表框中 For i = 0 To lstCurFiles.ListCount - 1 If lstCurFiles.Selected(i) Then strFlies = lstCurFiles.List(i) n = n + 1

If Not HasItem(lstPlotFiles, strFlies) Then lstPlotFiles.AddItem lstCurFiles.List(i) End If End If Next i

'如果列表框中未存在被选择的元素 If n = 0 Then

MsgBox \请选择要从列表中添加的元素!\ Exit Sub End If End Sub

Private Sub cmdAddAll_Click() '如果列表框中未存在任何元素

If lstCurFiles.ListCount = 0 Then

MsgBox \请先向列表框中添加文件!\ Exit Sub End If

Dim strFlies As String Dim i As Integer

'将上面列表框中选中的对象添加到下面的列表框中 For i = 0 To lstCurFiles.ListCount - 1 strFlies = lstCurFiles.List(i)

If Not HasItem(lstPlotFiles, strFlies) Then lstPlotFiles.AddItem lstCurFiles.List(i) End If Next i End Sub

Private Sub cmdBrowse_Click() '在文本框中显示获得的路径

txtCurPath.Text = ReturnFolder(0) End Sub

Private Sub cmdBrowse2_Click() Dim strPath As String

strPath = ReturnFolder(0) '若返回文件夹路径非空 If strPath <> \

'若组合框中未存在返回文件夹路径,则将其添加到组合框中 If HasItem2(strPath) < 0 Then '在组合框中显示获得的路径 With cboPlotPath

.AddItem strPath, 0 '使用下拉列表的形式

.Style = fmStyleDropDownList '设置下拉列表的下标下限 .BoundColumn = 0 '设置默认的显示项目 .ListIndex = 0

End With

'若组合框中已存在返回文件夹路径,则将返回文件夹路径置为选中 Else

With cboPlotPath

'设置默认的显示项目

.ListIndex = HasItem2(strPath) End With End If End If End Sub

Private Sub cmdClear_Click() '如果列表框中未存在任何元素

If lstPlotFiles.ListCount = 0 Then

MsgBox \请先向列表框中添加文件!\ Exit Sub End If

Dim i As Integer, n As Integer, count As Integer '列表框中元素的数量

count = lstPlotFiles.ListCount n = 0

'将列表框中选中的对象删除 For i = 0 To count - 1

If lstPlotFiles.Selected(i) Then n = n + 1 Else

'移动列表框中的元素

lstPlotFiles.List(i - n) = lstPlotFiles.List(i) End If Next i

'如果列表框中未存在被选择的元素 If n = 0 Then

MsgBox \请选择要从列表中清除的元素!\ Exit Sub End If

'删除最后n行的元素 For i = 1 To n

lstPlotFiles.RemoveItem (count - i) Next i

End Sub

Private Sub cmdClearAll_Click() '如果列表框中未存在任何元素

If lstPlotFiles.ListCount = 0 Then

MsgBox \请先向列表框中添加文件!\ Exit Sub End If

Dim Msg, Style, Title, Help, Ctxt, Response, MyString Msg = \清除整个图形列表?\

Style = vbOKCancel + vbQuestion + vbDefaultButton2 Title = \

Response = MsgBox(Msg, Style, Title) If Response = vbOK Then txtCurPath.Text = \ '清除列表框中所有元素 lstPlotFiles.Clear End If

End Sub

Private Sub cmdExit_Click() '退出 End End Sub

Private Sub cmdInput_Click() '导入打印设置 '设置标准对话框 With comDlg

'设置标准对话框标题

.DialogTitle = \导入打印设置\

'设置标准对话框类型列表中所显示的过滤器

.filter = \文本文件(*.txt)|*.txt|所有文件(*.*)|*.*\ '显示[打开]对话框 .ShowOpen End With

Dim strFileName As String

strFileName = comDlg.fileName '若返回文件名为空,不进行操作 If strFileName = \

MsgBox \请重新选择文件位置!\


cad打印代码(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:杭州市2018年中考数学真题试题(含答案)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: