createthemes.frm

来自「vb+mapx小型地图系统」· FRM 代码 · 共 317 行

FRM
317
字号
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form createThemes 
   Caption         =   "创建专题图"
   ClientHeight    =   4635
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5280
   Icon            =   "createThemes.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   4635
   ScaleWidth      =   5280
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1440
      TabIndex        =   9
      Text            =   "Text1"
      Top             =   3960
      Width           =   2415
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   495
      Left            =   4080
      TabIndex        =   7
      Top             =   1440
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   495
      Left            =   4080
      TabIndex        =   6
      Top             =   600
      Width           =   975
   End
   Begin VB.ComboBox Combo2 
      Height          =   300
      Left            =   1440
      TabIndex        =   5
      Text            =   "Combo2"
      Top             =   3120
      Width           =   2415
   End
   Begin VB.ListBox List1 
      Height          =   1680
      Left            =   1440
      MultiSelect     =   2  'Extended
      TabIndex        =   4
      Top             =   1200
      Width           =   2415
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   1440
      TabIndex        =   3
      Text            =   "Combo1"
      Top             =   240
      Width           =   2415
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   2640
      Top             =   2040
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label Label4 
      Caption         =   "专题图名称"
      Height          =   375
      Left            =   120
      TabIndex        =   8
      Top             =   3960
      Width           =   1095
   End
   Begin VB.Label Label3 
      Caption         =   "专题图类型"
      Height          =   495
      Left            =   120
      TabIndex        =   2
      Top             =   3120
      Width           =   1095
   End
   Begin VB.Label Label2 
      Caption         =   "选择专题变量"
      Height          =   495
      Left            =   120
      TabIndex        =   1
      Top             =   1200
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "选择数据集"
      Height          =   615
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   1095
   End
End
Attribute VB_Name = "createThemes"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim Combo1str As String
Dim Combo2str As String

Dim cnnstr As String







Private Sub Combo1_Click()
Dim sqlstr As String

Combo1str = Combo1.Text
Combo1.Enabled = False

cnnstr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\mapdata\my.mdb;user id=admin;" & " password=;Persist Security Info=False"

cnn.ConnectionString = cnnstr
cnn.CursorLocation = adUseClient

cnn.Open
If cnn.State = adStateOpen Then

sqlstr = "select * from " & Combo1str
Set rs = cnn.Execute(sqlstr)
For i = 0 To rs.Fields.Count - 1
List1.AddItem rs.Fields(i).Name
Next i

Else
MsgBox "无法打开数据源或数据源不存在", 64, "信息提示"
End If





End Sub

Private Sub Combo2_Click()
Text1.SetFocus

End Sub

Private Sub Command1_Click()
Dim ii As Integer

c_themename = Text1.Text
  ii = Len(c_themename)
Select Case ii
Case Is > 0

 Dim thmtype As Integer
If List1.SelCount = 0 Then
GoTo done
ElseIf List1.SelCount = 1 Then
      If Combo2.ListIndex = 0 Then
       thmtype = miThemeRanged

      ElseIf Combo2.ListIndex = 1 Then
       thmtype = miThemeGradSymbol
       ElseIf Combo2.ListIndex = 2 Then
       thmtype = miThemeDotDensity
          Else
          thmtype = miThemeIndividualVale

            End If

              Else
             If Combo2.ListIndex = 0 Then
              thmtype = miThemePieChart
               Else
               thmtype = miThemeBarChart
       End If
End If
 
 mainform.Map1.DataSets.RemoveAll
   Set c_mydataset = mainform.Map1.DataSets.Add(miDataSetADO, rs, "MyDataSet", "Name_yy", , Combo1str)
Dim flds As New MapXLib.Fields

For i = 0 To List1.ListCount - 1
 If List1.Selected(i) Then
            flds.Add rs.Fields(i).Name, rs.Fields(i).Name, miAggregationAuto
            
            End If
   Next i
  
   
   
 
     Set c_theme = c_mydataset.Themes.Add(thmtype, flds, c_themename)
              mainform.munCreatetheme.Enabled = False
                 mainform.munmodifyTheme.Enabled = True
                 mainform.munmodifylegend.Enabled = True
           mainform.muncloseTheme.Enabled = True
           Unload Me
      Case Is <= 0
      MsgBox "请输入专题图名称", 64, "信息提示"
          Text1.SetFocus
          
       End Select

      
done:
      Unload Me
      
            


End Sub

Private Sub Command2_Click()
Unload Me

End Sub

Private Sub Form_Load()
createThemes.Top = 100
createThemes.Left = 100
Command1.Enabled = False
Text1.Text = ""
Combo1.Enabled = True
List1.Clear
Combo1.Clear
Combo2.Clear

Dim T_layer As MapXLib.layer
For Each T_layer In mainform.Map1.Layers
           Combo1.AddItem T_layer.Name
           Next

End Sub

Private Sub Form_Unload(Cancel As Integer)

Set rs = Nothing
Set cnn = Nothing
End Sub

Private Sub List1_Click()
Combo2.Clear
If List1.SelCount = 0 Then
ElseIf List1.SelCount = 1 Then
Combo2.AddItem "范围值"
Combo2.AddItem "等级符号"

Combo2.AddItem "点密度"

Combo2.AddItem "独立值"
If rs.Fields(List1.ListIndex).Type = adChar Then
comb2.ListIndex = 3
Else
Combo2.ListIndex = 0
End If
Else

Combo2.AddItem "饼图"
Combo2.AddItem "直方图"
Combo2.ListIndex = 0
End If
End Sub

Private Sub Text1_Change()
Command1.Enabled = True

End Sub

⌨️ 快捷键说明

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