⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 都是基于VB所做的程序集合,值得大家作为实践的参考资料.
💻 FRM
字号:
VERSION 5.00
Object = "{03ED3B1E-ED1B-4A2E-8FE3-D8D1A673F5D4}#5.2#0"; "SuperMap.ocx"
Object = "{AB69DB6A-F6B5-4BCD-BF57-170D7A3F41F5}#5.2#0"; "SuperGridView.ocx"
Begin VB.Form frmMain 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   $"frmMain.frx":0000
   ClientHeight    =   6825
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   12210
   Icon            =   "frmMain.frx":00A5
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6825
   ScaleWidth      =   12210
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出"
      Height          =   435
      Left            =   9330
      TabIndex        =   12
      Top             =   30
      Width           =   1005
   End
   Begin VB.CommandButton cmdRelQuery 
      Caption         =   "关联查询"
      Height          =   435
      Left            =   7410
      TabIndex        =   11
      Top             =   30
      Width           =   1005
   End
   Begin VB.CommandButton cmdCmQuery 
      Caption         =   "普通查询"
      Height          =   435
      Left            =   6357
      TabIndex        =   10
      Top             =   30
      Width           =   1005
   End
   Begin VB.CommandButton cmdViewEnt 
      Caption         =   "全幅"
      Height          =   435
      Left            =   5305
      TabIndex        =   9
      Top             =   30
      Width           =   1005
   End
   Begin VB.CommandButton cmdPan 
      Caption         =   "漫游"
      Height          =   435
      Left            =   4253
      TabIndex        =   8
      Top             =   30
      Width           =   1005
   End
   Begin VB.CommandButton cmdZoomFree 
      Caption         =   "自由缩放"
      Height          =   435
      Left            =   3201
      TabIndex        =   7
      Top             =   30
      Width           =   1005
   End
   Begin VB.CommandButton cmdZoomOut 
      Caption         =   "缩小"
      Height          =   435
      Left            =   2149
      TabIndex        =   6
      Top             =   30
      Width           =   1005
   End
   Begin VB.CommandButton cmdZoomIn 
      Caption         =   "放大"
      Height          =   435
      Left            =   1097
      TabIndex        =   5
      Top             =   30
      Width           =   1005
   End
   Begin VB.CommandButton cmdSelect 
      Caption         =   "选择"
      Height          =   435
      Left            =   45
      TabIndex        =   4
      Top             =   30
      Width           =   1005
   End
   Begin VB.Frame Frame2 
      Height          =   6420
      Left            =   7905
      TabIndex        =   2
      Top             =   405
      Width           =   4155
      Begin SuperGridViewLib.SuperGridView SuperGridView 
         Height          =   6300
         Left            =   120
         TabIndex        =   3
         Top             =   120
         Width           =   3975
         _Version        =   327682
         _ExtentX        =   7011
         _ExtentY        =   11112
         _StockProps     =   0
      End
   End
   Begin VB.Frame Frame1 
      Height          =   6435
      Left            =   0
      TabIndex        =   0
      Top             =   405
      Width           =   7890
      Begin SuperMapLib.SuperMap SuperMap 
         Height          =   6285
         Left            =   45
         TabIndex        =   1
         Top             =   120
         Width           =   7800
         _Version        =   327682
         _ExtentX        =   13758
         _ExtentY        =   11086
         _StockProps     =   160
         Appearance      =   1
      End
   End
   Begin SuperMapLib.SuperWorkspace SuperWorkspace 
      Left            =   480
      Top             =   795
      _Version        =   327682
      _ExtentX        =   847
      _ExtentY        =   847
      _StockProps     =   0
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'=====================================SuperMap Objects示范工程说明=======================================
'
'功能简介:示范SuperMap Objects的关联表信息对象的使用
'所用控件:SuperMap控件、SuperWorkspace控件和SuperGridView控件
'所用数据:data\RelQueryTableInfo的relquerytableinfo.sdb和relquerytableinfo.sdd文件。
'操作说明:
'         1、点击“普通查询”按钮,实现对地图窗口的World数据集的Query查询,
'            并将查询结果显示在SuperGridView属性框中。
'         2、点击“关联查询”按钮,实现对地图窗口的World数据集和ReTable进行关联属性查询,
'            并将关联查询结果显示在SuperGridView属性框中。请注意两种查询返回的字段个数的
'            差别。
'
'===================================SuperMap Objects示范工程说明结束=====================================

Option Explicit

Private Sub cmdCmQuery_Click()
    Dim objDtv As soDatasetVector
    Dim objRst As soRecordset
    
    If SuperMap.Layers.Count = 0 Then Exit Sub
    
    Set objDtv = SuperMap.Layers(1).Dataset
    If objDtv Is Nothing Then Exit Sub
    
    Set objRst = objDtv.Query("", False)
    
    SuperGridView.Connect objRst
    SuperGridView.Update
    
    Set objRst = Nothing
    Set objDtv = Nothing
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub cmdPan_Click()
    SuperMap.Action = scaPan
End Sub

Private Sub cmdRelQuery_Click()
    Dim objDtv As soDatasetVector
    Dim objRst As soRecordset
    
    If SuperMap.Layers.Count = 0 Then Exit Sub
    Set objDtv = SuperMap.Layers(1).Dataset
    
    Dim objQuery As New soQueryDef
    Dim objRel As New soRelQueryTableInfo
    
    objQuery.QueryType = scqGeneral '设置查询类型
    objQuery.Filter = "World.SmID>0" '设置查询条件
    
    objRel.JoinType = scjInnerJoin '设置关联方式
    objRel.SearchCondition = "World.rkey = ReTable.rkey" '设置关联条件
    objRel.TableName = "ReTable" '设置关联表名
    
    objQuery.RelTables.Add objRel '将定义的关联信息添加到查询中
    
    Set objRst = objDtv.Query2(objQuery) '开始查询
    
    SuperGridView.Connect objRst
    SuperGridView.Update
    
    Set objRst = Nothing
    Set objQuery = Nothing
    Set objRel = Nothing
    Set objDtv = Nothing
End Sub

Private Sub cmdSelect_Click()
    SuperMap.Action = scaSelect
End Sub

Private Sub cmdViewEnt_Click()
    SuperMap.ViewEntire
    SuperMap.Refresh
End Sub

Private Sub cmdZoomFree_Click()
    SuperMap.Action = scaZoomFree
End Sub

Private Sub cmdZoomIn_Click()
    SuperMap.Action = scaZoomIn
End Sub

Private Sub cmdZoomOut_Click()
    SuperMap.Action = scaZoomOut
End Sub

Private Sub Form_Load()
    Dim objDs As soDataSource
    Dim objDt As soDataset
    
    SuperMap.Connect SuperWorkspace.Handle
    
    Set objDs = SuperWorkspace.OpenDataSource(App.Path & "\..\Data\RelQueryTableInfo\relquerytableinfo.sdb", "RelQuery", sceSDBPlus, True)
    If objDs Is Nothing Then Exit Sub
    Set objDt = objDs.Datasets("World")
    If objDt Is Nothing Then Exit Sub
    SuperMap.Layers.AddDataset objDt, True
    
    SuperMap.ViewEntire
    
    Set objDt = Nothing
    Set objDs = Nothing
End Sub

Private Sub Form_Unload(Cancel As Integer)
    SuperGridView.Disconnect
    
    SuperMap.Close
    SuperMap.Disconnect
    
    SuperWorkspace.Close
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -