utilities.bas

来自「用vc+mapx制作的地理信息系统软件」· BAS 代码 · 共 36 行

BAS
36
字号
Attribute VB_Name = "modUtilities"
Public SDECon As New MapObjects2.DataConnection
Public bSDEConnected As Boolean

'将窗体居中
Public Sub CenterForm(frm As Form)
  frm.Top = (Screen.Height - frm.Height) \ 2
  frm.Left = (Screen.Width - frm.Width) \ 2
End Sub

'选中TextBox中的文字
Public Sub HiliteText(Ctrl As Control)
  Ctrl.SelStart = 0
  Ctrl.SelLength = Len(Ctrl)
End Sub

'将文件的完全路径分割为文件名和路径
Sub SplitPath(pathName As String, dirName As String, fileName As String)
  '寻找最后一个"\",以分割文件名和路径
  ' in the path
  Dim nCurPos As Integer, nLastPos As Integer
  Do
    nLastPos = nCurPos
    nCurPos = InStr(nCurPos + 1, pathName, "\")
  Loop Until nCurPos = 0

  If nLastPos = 0 Then Exit Sub

  Dim fname As String
  dirName = Left(pathName, nLastPos - 1)
  fname = Right(pathName, Len(pathName) - nLastPos)
  fileName = Left(fname, Len(fname) - 4)
End Sub


⌨️ 快捷键说明

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