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

📄 form09.frm

📁 给出了详细的vb环境下mo基本功能的代码 如图层的加载
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form09 
   Caption         =   "墨西哥地图"
   ClientHeight    =   5295
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7095
   LinkTopic       =   "Form1"
   ScaleHeight     =   5295
   ScaleWidth      =   7095
   StartUpPosition =   2  '屏幕中心
   Begin VB.Timer tmrToolTip 
      Left            =   3480
      Top             =   2400
   End
   Begin VB.PictureBox picToolTip 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   1440
      ScaleHeight     =   225
      ScaleWidth      =   600
      TabIndex        =   1
      Top             =   1080
      Width           =   635
      Begin VB.Label lblToolTip 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Label1"
         Height          =   180
         Left            =   50
         TabIndex        =   2
         Top             =   30
         Width           =   630
      End
   End
   Begin MapObjects2.Map Map1 
      Height          =   5055
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6855
      _Version        =   131072
      _ExtentX        =   12091
      _ExtentY        =   8916
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form09.frx":0000
   End
End
Attribute VB_Name = "Form09"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xue Wei,2003/5/14
'添加鼠标提示的功能;

Option Explicit
Dim m_mapTip As New MapTip

Private Sub Map1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  m_mapTip.MouseMove x, y
End Sub

Private Sub tmrToolTip_Timer()
  m_mapTip.Timer
End Sub

Sub DrawLayer()
  Dim dc As New DataConnection
  Dim layer As MapLayer
  dc.Database = App.Path + "\..\" + "Mexico"
  If Not dc.Connect Then
    MsgBox "在指定的文件夹下没找到图层数据文件!"
    End
  End If
  
  Set layer = New MapLayer
  Set layer.GeoDataset = dc.FindGeoDataset("States")
  layer.Symbol.Color = moYellow
  Map1.Layers.Add layer
  
  Set layer = New MapLayer
  Set layer.GeoDataset = dc.FindGeoDataset("Rivers")
  layer.Symbol.Color = moRed
  Map1.Layers.Add layer
  Map1.Refresh
  
  Set layer = New MapLayer
  Set layer.GeoDataset = dc.FindGeoDataset("Cities")
  layer.Symbol.Color = moBlue
  Map1.Layers.Add layer
End Sub

Private Sub Form_Load()
  Dim layer As New MapObjects2.MapLayer
  DrawLayer
  '初始化MapTip类;
  Set layer = Map1.Layers("States")
  m_mapTip.Initialize Map1, tmrToolTip, picToolTip, lblToolTip
  m_mapTip.SetLayer layer, "NAME"
End Sub

⌨️ 快捷键说明

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