module1.bas

来自「MapX控件与VB的二次开发。主要功能由TAB文件的新建」· BAS 代码 · 共 39 行

BAS
39
字号
Attribute VB_Name = "Module1"
' 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(MapBrower.Map1.Layers.InsertionLayer) Then
        IsInsertionLayer = False
    ElseIf lyr = MapBrower.Map1.Layers.InsertionLayer Then
        IsInsertionLayer = True
    Else
        IsInsertionLayer = False
    End If
End Function

⌨️ 快捷键说明

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