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

📄 form01.frm

📁 给出了详细的vb环境下mo基本功能的代码 如图层的加载
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form01 
   Caption         =   "墨西哥地图"
   ClientHeight    =   5220
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6765
   LinkTopic       =   "Form1"
   ScaleHeight     =   5220
   ScaleWidth      =   6765
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "Command2"
      Height          =   495
      Left            =   3600
      TabIndex        =   2
      Top             =   4680
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   1680
      TabIndex        =   1
      Top             =   4680
      Width           =   1335
   End
   Begin MapObjects2.Map Map1 
      Height          =   4575
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   6735
      _Version        =   131072
      _ExtentX        =   11880
      _ExtentY        =   8070
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form01.frx":0000
   End
End
Attribute VB_Name = "Form01"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xuewei,2003/6/18
'用OLE DB接口和Access数据库的一个表建立Table对象的示例;

Option Explicit

Dim dc As New DataConnection

Private Sub Command1_Click()
  Dim pTable As MapObjects2.Table
  Dim Str1 As String
 
  Str1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\..\xue2.mdb"
  Set pTable = New MapObjects2.Table
  pTable.Database = Str1
  pTable.Name = "cities"
  MsgBox pTable.Records.TableDesc.FieldName(0)
End Sub

Private Sub Command2_Click()
  Dim Cnn2 As ADODB.Connection
  Dim pCommand As New ADODB.Command
  Dim pTable As New MapObjects2.Table
  Dim Str1 As String
 
  Set Cnn2 = New ADODB.Connection
  Str1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\..\xue2.mdb"
  Cnn2.ConnectionString = Str1
  Cnn2.Open

  pCommand.ActiveConnection = Cnn2
  pCommand.CommandType = adCmdText
  pCommand.CommandText = "select * from CITIES"
  Set pTable.Command = pCommand
  MsgBox pTable.Records.TableDesc.FieldName(0)
End Sub

Private Sub Form_Load()
 DrawLayer
End Sub

Private Sub DrawLayer()
  Dim Layer As MapLayer
  dc.Database = App.Path + "\..\" + "Mexico"
  Set Layer = New MapLayer
  Set Layer.GeoDataset = dc.FindGeoDataset("States")
 
  Map1.Layers.Add Layer
  
End Sub

⌨️ 快捷键说明

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