📄 form06.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form06
Caption = "Mesure"
ClientHeight = 4905
ClientLeft = 60
ClientTop = 345
ClientWidth = 5100
LinkTopic = "Form1"
ScaleHeight = 4905
ScaleWidth = 5100
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "开始"
Height = 495
Left = 1800
TabIndex = 2
Top = 4320
Width = 1335
End
Begin VB.ListBox List1
Height = 960
Left = 480
TabIndex = 1
Top = 3240
Width = 3855
End
Begin MapObjects2.Map Map1
Height = 2895
Left = 120
TabIndex = 0
Top = 120
Width = 4815
_Version = 131072
_ExtentX = 8493
_ExtentY = 5106
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "Form06.frx":0000
End
End
Attribute VB_Name = "Form06"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xue Wei,2003/6/1
'Measures练习;
'从MO的帮助中修改而来。
Option Explicit
Dim Line1 As New MapObjects2.Line
Private Sub Command1_Click()
Dim P1 As Point
Dim Pts As MapObjects2.Points
Set Line1 = New MapObjects2.Line
Set Pts = New MapObjects2.Points
Set P1 = Map1.ToMapPoint(100, 100)
Pts.Add P1
Set P1 = Map1.ToMapPoint(4500, 2500)
Pts.Add P1
Set P1 = Map1.ToMapPoint(500, 1500)
Pts.Add P1
Line1.Parts.Add Pts
Set Pts = Line1.Parts(0)
outputMeasures Line1
Map1.Refresh
End Sub
Private Sub Form_Load()
List1.AddItem "单击“开始”"
End Sub
Private Sub Map1_AfterTrackingLayerDraw(ByVal hDC As stdole.OLE_HANDLE)
Dim sym As New Symbol
sym.Color = moRed
sym.SymbolType = moLineSymbol
sym.Size = 5
If Not Line1 Is Nothing Then
Map1.DrawShape Line1, sym
End If
End Sub
Private Sub outputMeasures(aLine As MapObjects2.Line)
Dim pCount As Integer
Dim itemCount As Integer
Dim partLine As MapObjects2.Points
Dim i As Integer
For Each partLine In aLine.Parts
pCount = pCount + 1
For i = 0 To partLine.Count - 1 Step 1
itemCount = itemCount + 1
With partLine.Item(i)
.Measure = 10 * i
List1.AddItem "点" & itemCount & vbTab & "X=" & _
Format(.x, "0.00") & vbTab & "Y=" & Format(.y, "0.00") & vbTab & "M=" & .Measure
End With
Next i
Next partLine
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -