📄 form06.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form06
Caption = "Buffer演示"
ClientHeight = 4815
ClientLeft = 60
ClientTop = 345
ClientWidth = 6195
LinkTopic = "Form1"
ScaleHeight = 4815
ScaleWidth = 6195
StartUpPosition = 3 '窗口缺省
Begin MapObjects2.Map Map1
Height = 4575
Left = 120
TabIndex = 0
Top = 120
Width = 5895
_Version = 131072
_ExtentX = 10398
_ExtentY = 8070
_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
'Xuewei,2003/6/5
'line的Buffer示例;
Option Explicit
Const Bdist = 0.5
Dim sym1 As New MapObjects2.Symbol
Dim sym2 As New MapObjects2.Symbol
Dim Line1 As New MapObjects2.Line
Dim buffLine As New MapObjects2.Polygon
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Set Line1 = Map1.TrackLine
Set buffLine = Line1.Buffer(Bdist, Map1.FullExtent)
Map1.TrackingLayer.Refresh True
End Sub
Private Sub Map1_AfterTrackingLayerDraw(ByVal hDC As stdole.OLE_HANDLE)
If Not Line1 Is Nothing Then
Map1.DrawShape Line1, sym1
End If
If Not buffLine Is Nothing Then
Map1.DrawShape buffLine, sym2
End If
End Sub
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 = moLimeGreen
Map1.Layers.Add layer
End Sub
Private Sub Form_Load()
DrawLayer
With sym1
.SymbolType = moLineSymbol
.Color = moRed
.Size = 3
End With
With sym2
.SymbolType = moFillSymbol
.Style = moGrayFill
.Color = moBlue
.OutlineColor = moBlue
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -