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

📄 form01.frm

📁 给出了详细的vb环境下mo基本功能的代码 如图层的加载
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form01 
   Caption         =   "form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3915
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   3915
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "Command2"
      Height          =   495
      Left            =   2040
      TabIndex        =   2
      Top             =   2520
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   600
      TabIndex        =   1
      Top             =   2520
      Width           =   1215
   End
   Begin MapObjects2.Map Map1 
      Height          =   2175
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3615
      _Version        =   131072
      _ExtentX        =   6376
      _ExtentY        =   3836
      _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/11
'设定Map大小;

Option Explicit

Private Sub Command1_Click()
  '设置Form;
  With Me
    .Height = 350 * 15
    .Width = 400 * 15
    .Left = (Screen.Width - .Width) / 2
    .Top = (Screen.Height - .Height) / 2
    .Caption = "一般设定屏幕"
  End With
  
  '设置Map;
  With Map1
    .Height = Me.Height - 1200
    .Width = Me.Width - 200
    .Top = 50
    .Left = 50
  End With
  
  '设置Command2;
  Command2.Visible = True
  With Command2
    .Height = 500
    .Width = 1000
    .Left = (Me.Width - .Width) / 2
    .Top = Map1.Top + Map1.Height + 100
    .Caption = "全屏幕"
  End With
  Command1.Visible = False
End Sub

Private Sub Command2_Click()
  '设置Form;
  With Me
    .Height = Screen.Height
    .Width = Screen.Width
    .Left = (Screen.Width - .Width) / 2
    .Top = (Screen.Height - .Height) / 2
    .Caption = "最大化屏幕"
  End With
  
  '设置Map;
  With Map1
    .Height = Me.Height - 1200
    .Width = Me.Width - 200
    .Top = 50
    .Left = 50
  End With
  
  '设置Command2;
  Command1.Visible = True
  With Command1
    .Height = 500
    .Width = 1000
    .Left = (Me.Width - .Width) / 2
    .Top = Map1.Top + Map1.Height + 100
    .Caption = "一般屏幕"
  End With
  Command2.Visible = False
End Sub

Private Sub Form_Load()
  Command1.Caption = "一般屏幕"
  Command2.Caption = "全屏幕"
  DrawLayer   '加载墨西哥地图;
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 = moLimeGreen
  Map1.Layers.Add layer
  
  Set layer = New MapLayer
  Set layer.GeoDataset = dc.FindGeoDataset("rivers")
  layer.Symbol.Color = moYellow
  Map1.Layers.Add layer
End Sub

⌨️ 快捷键说明

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