askask 发表于 2007-9-16 17:14

请问大家这个VB怎么写啊?

初学CAD,看到以下的一段宏VB,但是想修改为自己实用的一些功能,但是怎么改都不成功,望各位大虾们指点赐教、最好有详细的说明;)谢谢啦!
按照以下代码的大概意思(偶也看得不太懂~),打开和关闭、解锁和锁定 是针对所有层的操作的,如果我想针对于某个层 例如Bondary层使用如下操作,我该如何修改其代码? 烦劳各位详解大谢!!!
代码如下:

--------------------------------------------------------------------------------------------------
'打开所有图层
'***********************
Public Sub OpenAll_Layers()
Call OpenAllLayer(True)
End Sub
--------------------------------------------------------------------------------------------------
'关闭所有图层
'**********************
Public Sub CloseAll_Layers()
Call OpenAllLayer(False)
End Sub
--------------------------------------------------------------------------------------------------
'锁定所有图层
'***********************
Public Sub LockAll_Layers()
Call LockAllLayer(True)
End Sub
--------------------------------------------------------------------------------------------------
'解锁所有图层
'***********************
Public Sub UnLockAll_Layers()
Call LockAllLayer(False)
End Sub
;这些是工具栏按钮显示的名称;


--------------------------------------------------------------------------------------------------
'Close on Open All Layer
'*****************************************
Public Sub OpenAllLayer(ByVal IsOpen As Boolean)
Dim i As Integer
For i = 0 To ThisDrawing.Layers.count - 1
    If ThisDrawing.Layers.Item(i).Name = ThisDrawing.ActiveLayer.Name _
      And IsOpen = False Then
      ThisDrawing.Layers.Item(i).LayerOn = Not (IsOpen)
    Else
      ThisDrawing.Layers.Item(i).LayerOn = IsOpen
    End If
Next i
End Sub
--------------------------------------------------------------------------------------------------
'Lock on UnLock All Layer
'*****************************************
Public Sub LockAllLayer(ByVal IsLock As Boolean)
Dim i As Integer
For i = 0 To ThisDrawing.Layers.count - 1
    ThisDrawing.Layers.Item(i).Lock = IsLock
Next i
End Sub
--------------------------------------------------------------------------------------------------
;这些才是宏语言;

askask 发表于 2007-9-16 17:15

以上代码打开和关闭、解锁和锁定的修改   烦劳各位详解大谢了!!!
页: [1]
查看完整版本: 请问大家这个VB怎么写啊?