📄 frmsearchadv.frm
字号:
VERSION 5.00
Begin VB.Form FrmSearchAdv
BorderStyle = 1 'Fixed Single
Caption = "高级查询"
ClientHeight = 1500
ClientLeft = 45
ClientTop = 330
ClientWidth = 2565
Icon = "FrmSearchAdv.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 1500
ScaleWidth = 2565
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 0
TabIndex = 8
Top = 1080
Width = 615
End
Begin VB.CommandButton Command2
Caption = "模糊查找"
Height = 375
Left = 630
TabIndex = 7
Top = 1080
Width = 950
End
Begin VB.CommandButton Command1
Caption = "精确查找"
Height = 375
Left = 1590
TabIndex = 6
Top = 1080
Width = 950
End
Begin VB.TextBox Text1
Height = 270
Left = 1080
TabIndex = 4
Top = 720
Width = 1455
End
Begin VB.ComboBox Combo2
Height = 300
Left = 960
Style = 2 'Dropdown List
TabIndex = 3
Top = 360
Width = 1575
End
Begin VB.ComboBox Combo1
Height = 300
Left = 960
Style = 2 'Dropdown List
TabIndex = 1
Top = 0
Width = 1575
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "查询关键字:"
Height = 180
Left = 60
TabIndex = 5
Top = 760
Width = 1080
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "查询字段:"
Height = 180
Left = 60
TabIndex = 2
Top = 420
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "查询图层:"
Height = 180
Left = 60
TabIndex = 0
Top = 60
Width = 900
End
End
Attribute VB_Name = "FrmSearchAdv"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Validate(Cancel As Boolean)
Dim TempField As MapXLib.Field, TempFields As MapXLib.Fields
Dim TempDataset As MapXLib.Dataset
Dim TempLayer As MapXLib.Layer
Combo2.Clear
Set TempDataset = FrmMain.MyMap.DataSets.Add(miDataSetLayer, FrmMain.MyMap.Layers.Item(Combo1.Text))
For Each TempField In TempDataset.Fields
Combo2.AddItem TempField.Name
Next
Combo2.ListIndex = 0
End Sub
Private Sub Command1_Click()
Dim TempField As MapXLib.Field, TempFields As MapXLib.Fields
Dim TempDataset As MapXLib.Dataset, TempFeature As MapXLib.Feature
Dim TempLayer As MapXLib.Layer
Dim NodX As Node, NodY As Node, NodZ As Node
If Trim(Me.Text1.Text) = "" Then
MsgBox "请输入关键字"
Me.Text1.SetFocus
Exit Sub
End If
On Error Resume Next
FrmMain.SSTab1.Tab = 1
FrmMain.TreeView2.Nodes.Clear
Set TempLayer = FrmMain.MyMap.Layers.Item(Combo1.Text)
Set TempDataset = FrmMain.MyMap.DataSets.Add(miDataSetLayer, TempLayer)
Set TempFeatures = TempLayer.Search(Combo2.Text + " = """ + Trim(Me.Text1.Text) + """")
If TempFeatures.Count > 0 Then
Set NodX = FrmMain.TreeView2.Nodes.Add(, tvwChild, TempLayer.Name, TempLayer.Name)
NodX.EnsureVisible
For Each TempFeature In TempFeatures
Set NodY = FrmMain.TreeView2.Nodes.Add(NodX, tvwChild, TempLayer.Name + "|||" + TempFeature.FeatureKey, TempFeature.Name)
NodY.EnsureVisible
Next
Else
MsgBox "没有找到"
Me.Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
Dim TempField As MapXLib.Field, TempFields As MapXLib.Fields
Dim TempDataset As MapXLib.Dataset, TempFeature As MapXLib.Feature
Dim TempLayer As MapXLib.Layer
Dim NodX As Node, NodY As Node, NodZ As Node
If Trim(Me.Text1.Text) = "" Then
MsgBox "请输入关键字"
Me.Text1.SetFocus
Exit Sub
End If
On Error Resume Next
FrmMain.SSTab1.Tab = 1
FrmMain.TreeView2.Nodes.Clear
Set TempLayer = FrmMain.MyMap.Layers.Item(Combo1.Text)
Set TempDataset = FrmMain.MyMap.DataSets.Add(miDataSetLayer, TempLayer)
Set TempFeatures = TempLayer.Search(Combo2.Text + " like ""%" + Trim(Me.Text1.Text) + "%""")
If TempFeatures.Count > 0 Then
Set NodX = FrmMain.TreeView2.Nodes.Add(, tvwChild, TempLayer.Name, TempLayer.Name)
NodX.EnsureVisible
For Each TempFeature In TempFeatures
Set NodY = FrmMain.TreeView2.Nodes.Add(NodX, tvwChild, TempLayer.Name + "|||" + TempFeature.FeatureKey, TempFeature.Name)
NodY.EnsureVisible
Next
Else
MsgBox "没有找到"
Me.Text1.SetFocus
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim TempField As MapXLib.Field, TempFields As MapXLib.Fields
Dim TempDataset As MapXLib.Dataset
Dim TempLayer As MapXLib.Layer
Combo1.Clear
Combo2.Clear
For Each TempLayer In FrmMain.MyMap.Layers
If TempLayer.Selectable Then Combo1.AddItem TempLayer.Name
Next
Combo1.ListIndex = 0
Set TempDataset = FrmMain.MyMap.DataSets.Add(miDataSetLayer, FrmMain.MyMap.Layers.Item(Combo1.Text))
For Each TempField In TempDataset.Fields
Combo2.AddItem TempField.Name
Next
Combo2.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -