📄 frmmain.frm
字号:
VERSION 5.00
Object = "{E760686B-BC9E-4802-9ECF-175FDF4062CE}#5.0#0"; "MAPX50.DLL"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "ComDlg32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomctl.ocx"
Begin VB.Form frmMain
Caption = "Form1"
ClientHeight = 6645
ClientLeft = 1290
ClientTop = 1230
ClientWidth = 9645
LinkTopic = "Form1"
ScaleHeight = 6645
ScaleWidth = 9645
Begin MSComDlg.CommonDialog CM1
Left = 6480
Top = 1800
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComctlLib.ImageList ImageList1
Left = 4560
Top = 3000
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 3
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0112
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0224
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 660
Left = 0
TabIndex = 1
Top = 0
Width = 9645
_ExtentX = 17013
_ExtentY = 1164
ButtonWidth = 1032
ButtonHeight = 1005
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 3
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "新建"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "打开"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "选择"
ImageIndex = 3
EndProperty
EndProperty
End
Begin MapXLib.Map g_Map
Height = 5895
Left = 90
TabIndex = 0
Top = 600
Width = 9255
_Version = 500012
_ExtentX = 16325
_ExtentY = 10398
_StockProps = 1
MapCatalog.GeoDictionary= "GeoDictionary"
GeoSet = "Empty GeosetName {9A9AC2F4-8375-44d1-BCEB-476AE986F190}"
GeoSetUserName = "United States"
DefaultStyle.TextFontBackColor= 16777215
DefaultStyle.SupportsBitmapSymbols= -1 'True
DefaultStyle.SymbolChar= 55
DefaultStyle.SymbolFontBackColor= 16777215
BeginProperty DefaultStyle.TextFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty DefaultStyle.SymbolFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Map Symbols"
Size = 14.25
Charset = 2
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
DefaultStyle.LineStyle= 1
DefaultStyle.LineWidth= 1
DefaultStyle.RegionColor= 16777215
DefaultStyle.LinePattern= 2
DefaultStyle.RegionBackColor= 16777215
DefaultStyle.RegionBorderStyle= 1
DefaultStyle.RegionBorderWidth= 1
Title.Visible = 0 'False
Title.Text = "Empty Title {01A9504B-CE13-4415-A5A0-51D8C2F15204}"
Title.Style.TextFontBackColor= 16777215
Title.Style.TextFontOpaque= -1 'True
Title.Style.SymbolChar= 0
BeginProperty Title.Style.TextFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 23.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Title.Style.SymbolFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 23.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Title.X = 3085
Title.Y = 392
Map.NumericCoordSys.ProjectionInfo= "frmMain.frx":0676
Map.DisplayCoordSys.ProjectionInfo= "frmMain.frx":07A6
End
Begin VB.Menu files
Caption = "文件(&F)"
Begin VB.Menu file
Caption = "新建(&N)"
Index = 1
Shortcut = ^N
Visible = 0 'False
End
Begin VB.Menu file
Caption = "打开地图集文件(&O)"
Index = 2
Shortcut = ^O
End
Begin VB.Menu file
Caption = "保存地图集文件(&S)"
Index = 3
Shortcut = ^S
End
End
Begin VB.Menu edition
Caption = "编辑(&E)"
Begin VB.Menu selection
Caption = "选择"
Begin VB.Menu select
Caption = "点击选择"
Index = 1
End
Begin VB.Menu select
Caption = "圆形选择"
Index = 2
End
Begin VB.Menu select
Caption = "矩形选择"
Index = 3
End
End
Begin VB.Menu zoomin
Caption = "放大"
End
Begin VB.Menu zoomout
Caption = "缩小"
End
Begin VB.Menu move
Caption = "平移"
End
Begin VB.Menu addion
Caption = "添加"
Begin VB.Menu add
Caption = "添加点"
Index = 1
End
Begin VB.Menu add
Caption = "添加直线"
Index = 2
End
Begin VB.Menu add
Caption = "添加折线"
Index = 3
End
Begin VB.Menu add
Caption = "添加区域"
Index = 4
End
End
Begin VB.Menu zxion
Caption = "注释"
Begin VB.Menu zx
Caption = "文本注释"
Index = 1
End
Begin VB.Menu zx
Caption = "符号注释"
Index = 2
End
Begin VB.Menu zx
Caption = "标注"
Index = 3
End
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Public g_Map As MapXLib.Map
Private Sub file_Click(Index As Integer)
n = Index
Select Case n
Case 1
Dim lyrs As MapXLib.Layers
Dim lyr As MapXLib.Layer
Set lyr = g_Map.Layers.CreateLayer(lyr)
Case 2 '打开*.GST
'LayerInfo 的Type 属性
'0 - .tab
'1 - User Draw
'2 - self-registering Raster
'3 - Shape
'4 - Server (remote database)
'5 - Geodictionary username
' Type 0:
'"FileSpec", Yes, String
'"Name", No, String
'ex: AddParameter("FileSpec", "c:\data\states.tab")
'AddParameter("Name", "MyStatesLayer")
'
'Type 1:
'"Name", Yes, String
'ex: AddParameter("Name", "MyUserDraw")
'
'Type 2:
'"FileSpec", Yes, String
'"Name", No, String
'ex: AddParameter("FileSpec", "c:\raster\rainfall.tif")
'
'Type 3:
'"FileSpec", Yes, String
'"Name", No, String
'"CoordSys", Yes, Object (mapxlib.coordsys; mapx.coordsys.4)
'"Style", No, Object (mapxlib.style; mapx.style.4)
'
'Type 4:
'"Name", Yes, String
'"ConnectString", Yes, String
'"Query", Yes, String
'LayerOptions , No, Numeric
'(Probably in the next Beta refresh, "ToolKit", Yes, String will be recognized to differentiate between ODBC and ORAINET i.e. OCI for Oracle 8i connectivity)
'ex: AddParameter("Name", "RDBMSStates")
'AddParameter("ConnectString", "DSN=MyODBCDataSource")
'AddParameter("Query", "SELECT * FROM STATES")
'AddParameter("ToolKit", "ODBC")
'
'Type 5:
'"Name", Yes, String
'ex: AddParameter("Name", "US Places")
Dim filepath As String
Dim filename As String
On Error Resume Next
CM1.DialogTitle = "打开文件"
CM1.DefaultExt = "gst"
CM1.Filter = "GeoSet(*.gst)|*.gst"
CM1.CancelError = True
CM1.Action = 1
If Err.Number = 32755 Then Exit Sub
frmMain.g_Map.GeoSet = CM1.filename
'//////////////////////////////////////////////////////////////////////
' Dim filename As String
' Dim filepath As String
' Dim LayerName As String
''''Dim lyr As MapXLib.Layer
'Dim LayerInfo As New MapXLib.LayerInfo
'Dim FilterIndex As Integer
'Dim ftrs As New MapXLib.Features
'Dim csys As New MapXLib.CoordSys
'On Error Resume Next '发生错误,转到程序的第二行运行
' CM1.DialogTitle = "打开文件"
' CM1.DefaultExt = "Tab|*.tab"
' CM1.Filter = "表(*.tab)|*.tab|GeoTiff file(*.tif)|*.tif|shapefile(*.tab)|*.tab|ServerLayer(spatialware)"
' CM1.CancelError = True
' CM1.Action = 1
'If Err.Number = 32755 Then Exit Sub
' filename = CM1.FileTitle
' filepath = CM1.filename
' filepath = Left(filepath, InStr(filepath, filename) - 1)
' LayerName = Left(filename, InStr(filename, ".") - 1)
' FilterIndex = CM1.FilterIndex
'Select Case FilterIndex
'Case 1: '*.tab
' LayerInfo.Type = miLayerInfoTypeTab
' LayerInfo.AddParameter "FileSpec", filepath + filename
' LayerInfo.AddParameter "Name", LayerName
'
' Case 2: 'You must use Geotiff file.
'GeoTiff and Tiff:GeoTiff is a raster TIFF file that has stored the geographical coordinates
'of where it belongs on the earth. A TIFF is a regular raster file that need to
'be registered in Mi Pro.
' LayerInfo.Type = miLayerInfoTypeRaster
' LayerInfo.AddParameter "FileSpec", filepath + filename
' LayerInfo.AddParameter "Name", LayerName
'
Case 3: '*.shp --- Failed
On Error Resume Next
CM1.DialogTitle = "保存地图集"
CM1.DefaultExt = "gst"
CM1.Filter = "GeoSet(*.gst)|*.gst"
CM1.CancelError = True
CM1.Flags = &H2
CM1.Action = 2
If Err.Number = 32755 Then Exit Sub
filename = CM1.FileTitle
filepath = CM1.filename
filename = Left(filename, InStr(filename, ".") - 1)
g_Map.SaveMapAsGeoset filename, filepath
'csys.PickCoordSys
' csys.Set 1, 0
'''' 'Set Formmain.g_Map.DisplayCoordSys = csys
''''''''''' 'Set Formmain.g_Map.NumericCoordSys = csys
''' 'Formmain.g_Map.NumericCoordSys.PickCoordSys
''' 'Formmain.g_Map.DisplayCoordSys.PickCoordSys
'''' 'Formmain.g_Map.DisplayCoordSys.PickCoordSys
''' ' LayerInfo.Type = miLayerInfoTypeShape
' LayerInfo.AddParameter "FileSpec", filepath + filename
' LayerInfo.AddParameter "CoordSys", csys
'//////////////////////////////////////////////////////////////
' End Select
'将新建图层加入到数据集
If Option_AddToDataset = True Then
LayerInfo.AddParameter "AutoCreateDataset", 1
LayerInfo.AddParameter "datasetname", LayerName
End If
' Set lyr = g_Map.Layers.add(LayerInfo, 1)
'ChangeCombo
End Select
End Sub
Private Sub Form_Resize()
With g_Map
.Left = 120
.Top = 600
.Height = frmMain.ScaleHeight - Toolbar1.Height
.Width = frmMain.ScaleWidth
End With
End Sub
Private Sub g_Map_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
frmlayerdlg.Show
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -