modutil.bas

来自「MapX示例程序:编辑特征示例」· BAS 代码 · 共 32 行

BAS
32
字号
Attribute VB_Name = "ModUtil"
Option Explicit

' 判断图层是否为永久层
Public Function IsPermanent(lyr As Layer) As Boolean
    If LCase$(Right$(lyr.FileSpec, 3)) = "tab" Then
        IsPermanent = True
    Else
        IsPermanent = False
    End If
End Function

' 返回某对象是否可用
Public Function IsInvalidObject(Obj As Variant) As Boolean
    If IsNull(Obj) = True Or IsEmpty(Obj) = True Or TypeName(Obj) = "Nothing" Then
        IsInvalidObject = True
    Else
        IsInvalidObject = False
    End If
End Function

' 判断图层是否为插入层
Public Function IsInsertionLayer(lyr As Layer) As Boolean
    If IsInvalidObject(FrmMain.Map1.Layers.InsertionLayer) Then
        IsInsertionLayer = False
    ElseIf lyr = FrmMain.Map1.Layers.InsertionLayer Then
        IsInsertionLayer = True
    Else
        IsInsertionLayer = False
    End If
End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?