📄 form04.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form04
ClientHeight = 5550
ClientLeft = 60
ClientTop = 345
ClientWidth = 6495
LinkTopic = "Form1"
ScaleHeight = 5550
ScaleWidth = 6495
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 2640
TabIndex = 1
Top = 4800
Width = 1215
End
Begin MapObjects2.Map Map1
Height = 4335
Left = 120
TabIndex = 0
Top = 120
Width = 6255
_Version = 131072
_ExtentX = 11033
_ExtentY = 7646
_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/6/23
'产生DXF图层基本示例;
Option Explicit
Dim dc As MapObjects2.DataConnection
Private Sub Command1_Click()
Dim lyr As New MapObjects2.MapLayer
dc.Database = "[CADLine]..\chapter1102"
'dc.Database = "[CADArea]..\chapter1102"
'dc.Database = "[CADPoint]..\chapter1102"
Set lyr.GeoDataset = dc.FindGeoDataset("aa2.dxf")
If lyr.Valid Then
lyr.Symbol.Color = moRed
lyr.Symbol.Size = 3
Map1.Layers.Add lyr
Else
MsgBox "文件不存在"
Exit Sub
End If
End Sub
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Map1.Extent = Map1.TrackRectangle
Else
Map1.Pan
End If
End Sub
Private Sub Form_Load()
DrawLayer '加载世界地图的Country图层;
Command1.Caption = "显示DXF文件"
End Sub
Private Sub DrawLayer()
Dim Layer As MapLayer
Set dc = New MapObjects2.DataConnection
dc.Database = App.Path + "\..\" + "world"
Set Layer = New MapLayer
Set Layer.GeoDataset = dc.FindGeoDataset("Country")
Layer.Symbol.Color = moYellow
Layer.Symbol.OutlineColor = moBrown
Map1.Layers.Add Layer
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -