📄 frmselectedview.frm
字号:
VERSION 5.00
Begin VB.Form FrmSelectedView
Caption = "有选择的显示图形"
ClientHeight = 4530
ClientLeft = 60
ClientTop = 345
ClientWidth = 6015
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4530
ScaleWidth = 6015
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton CmdClear
Caption = "清除"
Height = 375
Left = 5160
TabIndex = 9
Top = 4080
Width = 855
End
Begin VB.CommandButton CmdCancel
Caption = "取消"
Height = 375
Left = 4200
TabIndex = 8
Top = 4080
Width = 855
End
Begin VB.CommandButton CmdOK
Caption = "确定"
Height = 375
Left = 3240
TabIndex = 7
Top = 4080
Width = 855
End
Begin VB.TextBox TxtFilter
Height = 1215
Left = 0
TabIndex = 6
Top = 2760
Width = 6015
End
Begin VB.CommandButton CmdAddValue
Caption = "V"
Height = 375
Left = 4800
TabIndex = 5
Top = 2280
Width = 495
End
Begin VB.CommandButton CmdaddField
Caption = "V"
Height = 375
Left = 360
TabIndex = 4
Top = 2280
Width = 495
End
Begin VB.ListBox lstValue
Height = 1035
Left = 3840
TabIndex = 3
Top = 1080
Width = 2175
End
Begin VB.Frame Frame1
Height = 1575
Left = 1920
TabIndex = 2
Top = 600
Width = 1815
Begin VB.CommandButton CmdGreateEqu
Caption = ">="
Height = 375
Left = 600
TabIndex = 21
Top = 120
Width = 495
End
Begin VB.CommandButton CmdLittleEqu
Caption = "<="
Height = 375
Left = 1200
TabIndex = 20
Top = 120
Width = 495
End
Begin VB.CommandButton CmdNotEquate
Caption = "<>"
Height = 375
Left = 0
TabIndex = 19
Top = 600
Width = 495
End
Begin VB.CommandButton CmdGreat
Caption = ">"
Height = 375
Left = 600
TabIndex = 18
Top = 600
Width = 495
End
Begin VB.CommandButton CmdLittle
Caption = "<"
Height = 375
Left = 1200
TabIndex = 17
Top = 600
Width = 495
End
Begin VB.CommandButton CmdAND
Caption = "AND"
Height = 375
Left = 0
TabIndex = 16
Top = 1080
Width = 495
End
Begin VB.CommandButton CmdOR
Caption = "OR"
Height = 375
Left = 600
TabIndex = 15
Top = 1080
Width = 495
End
Begin VB.CommandButton CmdNot
Caption = "NOT"
Height = 375
Left = 1200
TabIndex = 14
Top = 1080
Width = 495
End
Begin VB.CommandButton CmdEquate
Caption = "="
Height = 375
Left = 0
TabIndex = 13
Top = 120
Width = 495
End
End
Begin VB.ListBox lstField
Height = 1035
Left = 0
TabIndex = 1
Top = 1080
Width = 1815
End
Begin VB.ComboBox ComTables
Height = 315
Left = 0
TabIndex = 0
Top = 360
Width = 1815
End
Begin VB.Label Label3
Caption = "请选择操作符:"
Height = 255
Left = 2040
TabIndex = 12
Top = 360
Width = 1575
End
Begin VB.Label Label2
Caption = "请选择一个字段:"
Height = 375
Left = 0
TabIndex = 11
Top = 720
Width = 1455
End
Begin VB.Label Label1
Caption = "请选择一个表:"
Height = 375
Left = 0
TabIndex = 10
Top = 0
Width = 1455
End
End
Attribute VB_Name = "FrmSelectedView"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim isFieldTypeNum As Boolean
Private Sub CmdaddField_Click()
TxtFilter.Text = TxtFilter.Text + lstField.List(lstField.ListIndex)
End Sub
Private Sub CmdAddValue_Click()
If Not isFieldTypeNum Then
TxtFilter.Text = TxtFilter.Text + "'" + lstValue.List(lstValue.ListIndex) + "'"
Else
TxtFilter.Text = TxtFilter.Text + lstValue.List(lstValue.ListIndex)
End If
End Sub
Private Sub CmdAND_Click()
TxtFilter.Text = TxtFilter.Text + CmdAND.Caption
End Sub
Private Sub CmdCancel_Click()
Unload Me
End Sub
Private Sub CmdClear_Click()
TxtFilter.Text = ""
End Sub
Private Sub CmdEquate_Click()
TxtFilter.Text = TxtFilter.Text + CmdEquate.Caption
End Sub
Private Sub CmdGreat_Click()
TxtFilter.Text = TxtFilter.Text + CmdGreat.Caption
End Sub
Private Sub CmdGreateEqu_Click()
TxtFilter.Text = TxtFilter.Text + CmdGreateEqu.Caption
End Sub
Private Sub CmdLittle_Click()
TxtFilter.Text = TxtFilter.Text + CmdLittle.Caption
End Sub
Private Sub CmdLittleEqu_Click()
TxtFilter.Text = TxtFilter.Text + CmdLittleEqu.Caption
End Sub
Private Sub CmdNot_Click()
TxtFilter.Text = TxtFilter.Text + CmdNot.Caption
End Sub
Private Sub CmdNotEquate_Click()
TxtFilter.Text = TxtFilter.Text + CmdNotEquate.Caption
End Sub
Private Sub CmdOK_Click()
Dim objOPipe As OriginatingPipe
Dim objRLE As RecordLegendEntry
Set objRLE = CreateObject("Geomedia.RecordLegendEntry")
gobjConnection.CreateOriginatingPipe objOPipe
With objOPipe
.GeometryFieldName = "Geometry"
.Table = ComTables.List(ComTables.ListIndex)
.Filter = TxtFilter.Text
End With
Set objRLE = GetLegendEntry(objOPipe.OutputRecordset)
DisplayTheLegendEntry objRLE
Unload Me
End Sub
Private Sub CmdOR_Click()
TxtFilter.Text = TxtFilter.Text + CmdOR.Caption
End Sub
Private Sub ComTables_click()
On Error GoTo ErrorHandler
Dim oMDS As New MetadataService
Set oMDS.Connection = gobjConnection
oMDS.TableName = ComTables.List(ComTables.ListIndex)
Dim vFields As Variant
oMDS.GetFields 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256, vFields ' gmmfByte + gmmfInteger + gmmfLong + gmmfCurrency + gmmfSingle + gmmfDouble + gmmfDate + gmmfText
lstField.Clear
Dim i As Long
For i = LBound(vFields) To UBound(vFields) - 1
lstField.AddItem vFields(i)
Next
lstField.ListIndex = 0
GoTo Finish
ErrorHandler:
MsgBox Err.Number & " - " & Err.Source & Chr(13) & _
Err.Description, vbOKOnly + vbExclamation
Finish:
On Error Resume Next
End Sub
Private Sub Form_Load()
Dim oMDS As New MetadataService
Set oMDS.Connection = gobjConnection
Dim vFeatures As Variant
oMDS.GetTables 1 + 2 + 4 + 8 + 32 + 128, vFeatures 'gmmtPoint + gmmtLinear + gmmtAreal + gmmtAnySpatial + gmmtGraphicsText + gmmtGraphic
Dim i As Long
For i = LBound(vFeatures) To UBound(vFeatures) - 1
ComTables.AddItem vFeatures(i)
Next i
End Sub
Private Sub lstField_Click()
On Error Resume Next
Dim valueCount As Long
Dim i As Long
Dim SqlQuery As String
Dim RcsUniq As GRecordset
StrField = lstField.List(lstField.ListIndex)
SqlQuery = "select distinct " & StrField & " from " & ComTables.List(ComTables.ListIndex)
Set RcsUniq = gobjConnection.Database.OpenRecordset(SqlQuery, gdbOpenDynaset)
'gmmfByte Or gmmfInteger Or gmmfLong Or gmmfCurrency Or gmmfSingle Or gmmfDouble
isFieldTypeNum = False
If RcsUniq.GFields(0).Type = 2 Or RcsUniq.GFields(0).Type = 3 Or RcsUniq.GFields(0).Type = 4 Or RcsUniq.GFields(0).Type = 5 Or RcsUniq.GFields(0).Type = 6 Or RcsUniq.GFields(0).Type = 7 Then
isFieldTypeNum = True
End If
RcsUniq.MoveLast
RcsUniq.MoveFirst
valueCount = RcsUniq.RecordCount
lstValue.Clear
For i = 1 To valueCount
lstValue.AddItem RcsUniq.GFields(StrField).Value
RcsUniq.MoveNext
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -