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

📄 form1.frm

📁 vb+mo进行开发的例子
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "Mo20.ocx"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4335
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7005
   LinkTopic       =   "Form1"
   ScaleHeight     =   4335
   ScaleWidth      =   7005
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdPan 
      Caption         =   "平移漫游"
      Height          =   375
      Left            =   2520
      TabIndex        =   3
      Top             =   120
      Width           =   1095
   End
   Begin VB.CommandButton cmdGlobe 
      Caption         =   "全图显示"
      Height          =   375
      Left            =   1320
      TabIndex        =   2
      Top             =   120
      Width           =   1095
   End
   Begin VB.CommandButton cmdZoomIn 
      Caption         =   "放大显示"
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   1095
   End
   Begin MapObjects2.Map Map1 
      Height          =   3735
      Left            =   0
      TabIndex        =   0
      Top             =   600
      Width           =   6975
      _Version        =   131072
      _ExtentX        =   12303
      _ExtentY        =   6588
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form1.frx":0000
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private bZoomOrPan As Boolean '当前状态是放大还是平移

'全图显示按钮单击事件响应代码
Private Sub cmdGlobe_Click()
    '设置Map1的当前显示范围是全图
    Set Map1.Extent = Map1.FullExtent
End Sub
'平移漫游按钮单击事件响应代码
Private Sub cmdPan_Click()
    '标志平移状态
    bZoomOrPan = False
    '设置鼠标指针
    Map1.MousePointer = moPan
End Sub

'放大显示按钮单击事件响应代码
Private Sub cmdZoomIn_Click()
    '标志放大状态
    bZoomOrPan = True
    '设置鼠标指针
    Map1.MousePointer = moZoomIn
End Sub

Private Sub Form_Resize()
    '判断窗体是否最小化
    If Me.WindowState <> 1 Then
        '当窗体改变大小时,自动改变Map Control大小
        Map1.Width = Me.ScaleWidth
        Map1.Height = Me.ScaleHeight - 600
    End If
End Sub

'Map Control的鼠标移动事件响应代码
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If bZoomOrPan Then
        '放大状态
        Dim tmpExtent As MapObjects2.Rectangle
        '跟踪用户输入的矩形显示范围
        Set tmpExtent = Map1.TrackRectangle
        If Not tmpExtent Is Nothing Then
            '设置Map Control的当前显示范围为用户输入的矩形
            Set Map1.Extent = tmpExtent
        End If
    Else
        '进入平移漫游状态,跟踪鼠标动作
        Map1.Pan
    End If
End Sub

⌨️ 快捷键说明

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