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

📄 form03.frm

📁 给出了详细的vb环境下mo基本功能的代码 如图层的加载
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form03 
   Caption         =   "世界地图"
   ClientHeight    =   5445
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7695
   LinkTopic       =   "Form1"
   ScaleHeight     =   5445
   ScaleWidth      =   7695
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "还原"
      Height          =   495
      Left            =   4440
      TabIndex        =   2
      Top             =   4800
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "投影"
      Height          =   495
      Left            =   2160
      TabIndex        =   1
      Top             =   4800
      Width           =   1215
   End
   Begin MapObjects2.Map Map1 
      Height          =   4575
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   7455
      _Version        =   131072
      _ExtentX        =   13150
      _ExtentY        =   8070
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form03.frx":0000
   End
End
Attribute VB_Name = "Form03"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xue Wei,2003/5/15
'坐标系投影示例-世界地图;

Option Explicit

Private Sub Command1_Click()
  Dim CSMap As Object
  Set CSMap = New MapObjects2.ProjCoordSys
  CSMap.Type = 54019   'World_Winkel-Ⅱ
  Map1.CoordinateSystem = CSMap
  'MsgBox CSMap.Unit.Name
End Sub

Private Sub Command2_Click()
  'GCS_WGS 1984 (4326)
  Map1.CoordinateSystem = Map1.Layers(0).CoordinateSystem.Type
End Sub

Private Sub Form_Load()
  Command1.Caption = "投影坐标系"
  Command2.Caption = "地理坐标系"
  DrawLayer   '加载世界地图;
End Sub

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


⌨️ 快捷键说明

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