modutil.bas

来自「GIS地理信息系统开发。大名鼎鼎的MAPX+VisualBasic6.0软件开发」· BAS 代码 · 共 38 行

BAS
38
字号
Attribute VB_Name = "ModUtil"
' This sample application and corresponding sample code is provided
' for example purposes only.  It has not undergone rigorous testing
' and as such should not be shipped as part of a final application
' without extensive testing on the part of the organization releasing
' the end-user product.
Option Explicit

' Return true if the layer is permanent. We do this by seeing if the layer has a
' .tab extension. If it's a temporary layer, it'll have a ".tmp" extension.
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

' Returns true if the object is invalid in some way. Returns false otherwise
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

' Returns true if lyr is the current insertion layer
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 + -
显示快捷键?