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

📄 form02.frm

📁 一个关于基于MO编程的参考资料希望对大家的交流和学习有帮助
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form02 
   Caption         =   "墨西哥地图"
   ClientHeight    =   5070
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6705
   LinkTopic       =   "Form2"
   ScaleHeight     =   5070
   ScaleWidth      =   6705
   StartUpPosition =   1  '所有者中心
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2160
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   4320
      Width           =   2415
   End
   Begin MapObjects2.Map Map1 
      Height          =   3975
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6495
      _Version        =   131072
      _ExtentX        =   11456
      _ExtentY        =   7011
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form02.frx":0000
   End
End
Attribute VB_Name = "Form02"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xuewei,,2003/4/17
'带线的文字显示
Option Explicit

Dim g_line As MapObjects2.Line
Dim pts As MapObjects2.Points
Dim tHeight As Double

Private 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
End Sub

Private Sub Form_Load()
  DrawLayer
End Sub


Private Sub Map1_AfterTrackingLayerDraw(ByVal hDC As stdole.OLE_HANDLE)
  Dim tSym As New TextSymbol
  Dim sym As New Symbol
  
  If Not g_line Is Nothing Then
    If pts.Count > 1 Then
      Set tSym.Font = Text1.Font
      sym.Color = moRed
      Map1.DrawShape g_line, sym
      tSym.Height = tHeight
      Map1.DrawText Text1.Text, g_line, tSym
    End If
  End If
  
  If Not pts Is Nothing Then
    sym.Color = moBlue
    sym.Size = 5
    Map1.DrawShape pts, sym
  End If
End Sub

Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   Dim P1 As MapObjects2.Point
   
   If g_line Is Nothing Then
     Set g_line = New MapObjects2.Line
   End If
   If pts Is Nothing Then
     Set pts = New MapObjects2.Points
   End If
  
   Set P1 = Map1.ToMapPoint(X, Y)
   pts.Add P1
   If pts.Count = 1 Then
     g_line.Parts.Add pts
     Set pts = g_line.Parts(0)
   End If
  
   Map1.TrackingLayer.Refresh True
End Sub


⌨️ 快捷键说明

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