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

📄 form06.frm

📁 给出了详细的vb环境下mo基本功能的代码 如图层的加载
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Object = "{C7FC2F7C-0688-11D5-B2F8-000102D87123}#1.0#0"; "mo21legend.ocx"
Begin VB.Form Form06 
   Caption         =   "墨西哥地图"
   ClientHeight    =   7620
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10560
   LinkTopic       =   "Form1"
   ScaleHeight     =   7620
   ScaleWidth      =   10560
   StartUpPosition =   2  '屏幕中心
   Begin MO21legend.legend legend1 
      Height          =   4695
      Left            =   120
      TabIndex        =   1
      Top             =   240
      Width           =   1095
      _ExtentX        =   1931
      _ExtentY        =   8281
      BackColor       =   -2147483644
      ForeColor       =   -2147483630
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MapObjects2.Map Map1 
      Height          =   7095
      Left            =   1320
      TabIndex        =   0
      Top             =   0
      Width           =   9255
      _Version        =   131072
      _ExtentX        =   16325
      _ExtentY        =   12515
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form06.frx":0000
   End
End
Attribute VB_Name = "Form06"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xue Wei,2003/5/2
'选择ArcExplore Legend组件

Option Explicit
Dim dc As New DataConnection
Dim layer As MapLayer

Private Sub legend1_AfterSetLayerVisible(index As Integer, isVisible As Boolean)
  Map1.Refresh
End Sub

Private Sub LayerSet()
  Set layer = New MapLayer
  Set layer.GeoDataset = dc.FindGeoDataset("States")
  layer.Symbol.Color = moOrange
  layer.Symbol.Size = 1
  layer.Symbol.Style = 2
  layer.Symbol.OutlineColor = moBrown
  layer.Name = "行政区"
  Map1.Layers.Add layer
  
  Set layer = New MapLayer
  Set layer.GeoDataset = dc.FindGeoDataset("Rivers")
  layer.Symbol.Color = moDarkGreen
  layer.Symbol.Size = 2
  layer.Name = "河流"
  Map1.Layers.Add layer
  
  Set layer = New MapLayer
  Set layer.GeoDataset = dc.FindGeoDataset("Cities")
  layer.Symbol.Color = moRed
  layer.Symbol.Size = 3
  layer.Symbol.Style = 0
  layer.Name = "城市"
  Set layer.Renderer = New LabelRenderer
  layer.Renderer.Field = "NAME"      '指定要显示的字段
  'layer.Renderer.Symbol(0).Font.Name = "幼圆"
  'layer.Renderer.Symbol(0).Font.Bold = False     '缺省为True
  layer.Renderer.Symbol(0).Color = moBlack
  layer.Renderer.Symbol(0).Font.Size = 8
  layer.Renderer.AllowDuplicates = True
  Map1.Layers.Add layer
End Sub

Private Sub Form_Load()
  dc.Database = App.Path + "\..\" + "Mexico"
  If Not dc.Connect Then
    MsgBox "在指定的文件夹下没找到图层数据文件!"
    End
  End If
  LayerSet
  
  legend1.setMapSource Map1
  legend1.LoadLegend True
  Map1.Refresh
End Sub


⌨️ 快捷键说明

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