www.pudn.com > 12136.rar > Form01.frm


VERSION 5.00 
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx" 
Begin VB.Form Form01  
   Caption         =   "墨西哥地图" 
   ClientHeight    =   4725 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   6765 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   4725 
   ScaleWidth      =   6765 
   StartUpPosition =   3  '窗口缺省 
   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/5/27 
'显示图层的坐标系对象; 
 
Option Explicit 
 
Private Sub Form_Load() 
  Dim Layer As MapLayer 
  Dim dc As New DataConnection 
    
  On Error GoTo Err1 
  dc.Database = App.Path + "\..\" + "Mexico" 
  Set Layer = New MapLayer 
  Set Layer.GeoDataset = dc.FindGeoDataset("states") 
  Layer.Symbol.Color = moLimeGreen 
  Map1.Layers.Add Layer 
  MsgBox "数据连接成功", vbInformation, "MO示例" 
  Exit Sub 
   
Err1: 
  If dc.ConnectError = 0 Then 
    MsgBox "没找到图层", vbInformation, "MO示例" 
  Else 
    MsgBox ConnectErrorMsg(dc.ConnectError), vbInformation, "MO示例" 
  End If 
  End 
End Sub