⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdiform1.frm

📁 VB开发MAPINFO OLE的例子(MDI)
💻 FRM
字号:
VERSION 4.00
Begin VB.MDIForm MDIForm1 
   BackColor       =   &H8000000C&
   Caption         =   "MapTest"
   ClientHeight    =   6060
   ClientLeft      =   450
   ClientTop       =   1185
   ClientWidth     =   10380
   Height          =   6750
   Left            =   390
   LinkTopic       =   "MDIForm1"
   Top             =   555
   Width           =   10500
   Begin VB.Menu M_FILE 
      Caption         =   "&File"
      Begin VB.Menu M_FILE_OPEN 
         Caption         =   "&Open Table"
         Shortcut        =   ^O
      End
      Begin VB.Menu M_FILE_LAYER 
         Caption         =   "&Layer Control"
         Shortcut        =   ^L
      End
      Begin VB.Menu M_FILE_EXIT 
         Caption         =   "E&xit"
         Shortcut        =   ^X
      End
   End
End
Attribute VB_Name = "MDIForm1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False

Private Sub M_FILE_EXIT_Click()
    Unload MDIForm1
End Sub

Private Sub M_FILE_LAYER_Click()
  MapInfo.RunMenuCommand 801
End Sub

Private Sub M_FILE_OPEN_Click()
Dim TableName As String
Dim FileSpec As String

FileSpec = MapInfo.Eval("FileOpenDlg("""","""",""TAB"",""Open Table"")")
If FileSpec <> "" Then
  TableName = MapInfo.Eval("PathToTableName$(""" + FileSpec + """)")
  MapInfo.Do ("Open Table """ + FileSpec + """ As " + TableName)
  
  Dim NewChild As New Form1
  NewChild.Show
  MapInfo.Do ("Set Next Document Parent " & NewChild.hwnd & " Style 1")
  MapInfo.Do ("Map From " + TableName)
End If

End Sub

Private Sub MDIForm_Load()
  Width = Screen.Width * 0.9 ' Set width of form.
  Height = Screen.Height * 0.9   ' Set height of form.
  Left = (Screen.Width - Width) / 2   ' Center form horizontally.
  Top = (Screen.Height - Height) / 2
  
  Set MapInfo = CreateObject("MapInfo.Application")
  MapInfo.Do "Set Application Window " & MDIForm1.hwnd
End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
    MapInfo.Do "Close All"
    Set MapInfo = Nothing
End Sub

⌨️ 快捷键说明

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