📄 search.frm
字号:
VERSION 5.00
Begin VB.Form Form5
Caption = "精确查询"
ClientHeight = 2280
ClientLeft = 60
ClientTop = 345
ClientWidth = 4740
LinkTopic = "Form5"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2280
ScaleWidth = 4740
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "取消查找"
Height = 375
Left = 1800
TabIndex = 7
Top = 1800
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "开始查找"
Default = -1 'True
Height = 375
Left = 3360
TabIndex = 6
Top = 1800
Width = 1095
End
Begin VB.ComboBox Combo2
Height = 300
Left = 2760
Style = 2 'Dropdown List
TabIndex = 5
Top = 720
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 2760
TabIndex = 3
Top = 1200
Width = 1695
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2760
Style = 2 'Dropdown List
TabIndex = 0
Top = 120
Width = 1815
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "请选择所要查询的字段"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 120
TabIndex = 4
Top = 720
Width = 2400
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "请输入所要查询的内容"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 120
TabIndex = 2
Top = 1320
Width = 2400
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请选择所要查询的图层"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 120
TabIndex = 1
Top = 120
Width = 2400
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
If Combo1.ListIndex <> -1 Then
Dim layerds As Dataset
Set layerds = Formmain.Map1.DataSets.Item(Combo1.Text & "dataset")
Dim fid As MapXLib.Field
Combo2.Clear
For Each fld In layerds.Fields
Combo2.AddItem fld.Name
Next
Combo2.ListIndex = 0
End If
End Sub
Private Sub Command1_Click()
On Error Resume Next
If Combo1.Text = "" Or Combo2.Text = "" Or Text1.Text = "" Then
MsgBox "请把你要查询的信息不完整", , "提示"
Exit Sub
End If
Formmain.TreeView1.Nodes.Clear
Dim findobj As MapXLib.Find
Dim Fdat As FindFeature
Set findobj = Formmain.Map1.Layers(Combo1.Text).Find
Set findobj.FindDataset = Formmain.Map1.DataSets(Combo1.Text & "dataset")
Set findobj.FindField = findobj.FindDataset.Fields(Combo2.Text)
Set Fdat = findobj.Search(Text1.Text)
If Fdat = Null Then
Unload Me
MsgBox "没有找到任何数据!", , "提示"
Else
Formmain.Map1.CenterX = Fdat.CenterX
Formmain.Map1.CenterY = Fdat.CenterY
Formmain.Map1.Layers(Combo1.Text).Selection.Replace Fdat
Unload Me
'MsgBox "数据已经找到!", , "提示"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Deactivate()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.Clear
Combo2.Clear
Dim lyR As Layer
For Each lyR In Formmain.Map1.Layers
Combo1.AddItem lyR.Name
Next
For Each lyR In Formmain.Map1.Layers
Formmain.Map1.DataSets.Add miDataSetLayer, lyR, lyR.Name & "dataset"
Next
Combo1.ListIndex = 0
Command1.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Formmain.Map1.DataSets.RemoveAll
End Sub
Private Sub Text1_Change()
If Text1.Text = "" Then
Command1.Enabled = False
Else
Command1.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -