📄 form04.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form04
Caption = "画线"
ClientHeight = 3885
ClientLeft = 60
ClientTop = 345
ClientWidth = 4350
LinkTopic = "Form1"
ScaleHeight = 3885
ScaleWidth = 4350
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "清除"
Height = 495
Left = 1320
TabIndex = 1
Top = 3360
Width = 1335
End
Begin MapObjects2.Map Map1
Height = 3255
Left = 0
TabIndex = 0
Top = 0
Width = 4335
_Version = 131072
_ExtentX = 7646
_ExtentY = 5741
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "form04.frx":0000
End
End
Attribute VB_Name = "Form04"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xuewei,2003/5/7
'在图上画点后,连成线。点击Command1清除。
Option Explicit
Dim g_Line As MapObjects2.Line
Dim Pts As MapObjects2.Points
Private Sub Command1_Click()
Set g_Line = Nothing
Set Pts = Nothing
Map1.Refresh
Set g_Line = New MapObjects2.Line
End Sub
Private Sub Map1_AfterTrackingLayerDraw(ByVal hDC As stdole.OLE_HANDLE)
Dim sym As New Symbol
If Not g_Line Is Nothing Then
sym.Color = moBlack
Map1.DrawShape Pts, sym
If Pts.Count > 1 Then
sym.Color = moRed
Map1.DrawShape g_Line, sym
End If
End If
End Sub
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim p As Point
If Button = 1 Then
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 p = Map1.ToMapPoint(X, Y)
Pts.Add p
If Pts.Count = 1 Then
g_Line.Parts.Add Pts
Set Pts = g_Line.Parts(0)
End If
Map1.TrackingLayer.Refresh True
Else
MsgBox "right"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -