有一个细节问题请教各位!
Dim oSpace As AcadBlock<BR>With ThisDrawing<BR> If .ActiveSpace = acModelSpace Then<BR> Set oSpace = .ModelSpace<BR> Else<BR> Set oSpace = .PaperSpace<BR> End If<BR>End With通过以上代码,现在oSpace中画图,适应于ModelSpace和PaperSpace,
但是,如果在PaperSpace中建一个视口,双击进入视口,这样,在视口里通过oSpace画的东西就会出现在PaperSpace中,而不在ModelSpace中,如何解决该问题? Function GetActiveSpace() As AcadBlock
Dim objSpace As AcadBlock
With ThisDrawing
If .ActiveSpace = acModelSpace Then
Set objSpace = .ModelSpace
Else
If .MSpace = False Then
Set objSpace = .PaperSpace
Else
Set objSpace = .ModelSpace
End If
End If
End With
Set GetActiveSpace = objSpace
End Function
Sub GetSpaceSample()
MsgBox "当前空间为: " & GetActiveSpace.Name, , "明经通道VBA示例"
End Sub OK了,谢谢版主!
页:
[1]