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

📄 form1.frm

📁 在VB中利用MO组件在图层中添加图形 for MO
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "Mo20.ocx"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6885
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8715
   LinkTopic       =   "Form1"
   ScaleHeight     =   6885
   ScaleWidth      =   8715
   StartUpPosition =   3  '窗口缺省
   Begin VB.OptionButton Option1 
      Caption         =   "矩形"
      Height          =   495
      Left            =   2040
      TabIndex        =   2
      Top             =   6240
      Value           =   -1  'True
      Width           =   1215
   End
   Begin VB.OptionButton Option2 
      Caption         =   "圆"
      Height          =   495
      Left            =   3600
      TabIndex        =   1
      Top             =   6240
      Width           =   1215
   End
   Begin VB.OptionButton Option3 
      Caption         =   "多边形"
      Height          =   495
      Left            =   5280
      TabIndex        =   0
      Top             =   6240
      Width           =   1215
   End
   Begin MapObjects2.Map Map1 
      Height          =   5655
      Left            =   120
      TabIndex        =   3
      Top             =   480
      Width           =   8415
      _Version        =   131072
      _ExtentX        =   14843
      _ExtentY        =   9975
      _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
Option Explicit
Dim Shp As Object
Private Function trackShape() As Object
  Dim poly As New MapObjects2.Polygon
  Dim evPoly As New MapObjects2.GeoEvent
  Set poly = Map1.TrackPolygon
  Set trackShape = poly
  Set evPoly = Map1.TrackingLayer.AddEvent(poly, 0)
  With Map1.TrackingLayer.Symbol(0)
    .SymbolType = moFillSymbol
    .Style = moGrayFill
    .Color = moRed
    .OutlineColor = moRed
  End With
End Function

Private Function trackShape1() As Object
  Dim poly As New MapObjects2.Rectangle
  Dim evPoly As New MapObjects2.GeoEvent
  Set poly = Map1.TrackRectangle
  Set trackShape1 = poly
  Set evPoly = Map1.TrackingLayer.AddEvent(poly, 0)
  With Map1.TrackingLayer.Symbol(0)
    .SymbolType = moFillSymbol
    .Style = moGrayFill
    .Color = moBlue
    .OutlineColor = moBlue
  End With
End Function

Private Function trackShape2() As Object
  Dim poly As New MapObjects2.Ellipse
  Dim evPoly As New MapObjects2.GeoEvent
  Set poly = Map1.TrackCircle
  Set trackShape2 = poly
  Set evPoly = Map1.TrackingLayer.AddEvent(poly, 0)
  With Map1.TrackingLayer.Symbol(0)
    .SymbolType = moFillSymbol
    .Style = moGrayFill
    .Color = moGreen
    .OutlineColor = moGreen
  End With
End Function

Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Option1 Then
    Set Shp = trackShape1
  ElseIf Option2 Then
    Set Shp = trackShape2
  Else
    Set Shp = trackShape
  End If
End Sub




⌨️ 快捷键说明

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