main.bas

来自「This sample demonstrates the use of the 」· BAS 代码 · 共 53 行

BAS
53
字号
Attribute VB_Name = "basMain"
Option Explicit

     ' ********************************
     ' global variables for paths
     ' ********************************
Public g_DataDir As String
Public g_VBDir As String
Public g_WorkDir As String
Public g_DemoDir As String
Public g_ImageDir As String


Sub main()

     ' find the directory structure
FindPaths

     ' show the main form
frmMain.Show


End Sub

Public Sub FindPaths()
 
 Dim strLoc As String
 
 strLoc = LCase(App.Path)
 If Index(strLoc, "\vb") > 0 Then
       ' in projects
   g_DemoDir = Before(strLoc, "\vb")
  Else
   g_DemoDir = strLoc
 End If  ' If Index(strLoc, "\vb") > 0 Then

Debug.Print "basMain: Demopath = " & g_DemoDir

       ' find the required directories
g_DataDir = g_DemoDir & "\data"
g_VBDir = g_DemoDir & "\vb"
g_ImageDir = g_DemoDir & "\images"
  
End Sub

Public Sub CenterForm(frm As Form)
     ' centers the form on the screen
   frm.Top = (Screen.Height - frm.Height) \ 2
   frm.Left = (Screen.Width - frm.Width) \ 2
End Sub


⌨️ 快捷键说明

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