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

📄 form1.frm

📁 刚得到的读取shape图片的visualbasic源程序
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   Caption         =   "Form1"
   ClientHeight    =   6285
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   7635
   LinkTopic       =   "Form1"
   ScaleHeight     =   6285
   ScaleWidth      =   7635
   StartUpPosition =   3  '窗口缺省
   Begin MSComctlLib.ListView ListView1 
      Height          =   5895
      Left            =   0
      TabIndex        =   2
      Top             =   360
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   10398
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      Checkboxes      =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   4560
      Top             =   0
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   3600
      Top             =   0
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   5
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0000
            Key             =   "arrow"
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0112
            Key             =   "zoomin"
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0224
            Key             =   "zoomout"
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0336
            Key             =   "pan"
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0448
            Key             =   "globe"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   390
      Left            =   1440
      TabIndex        =   1
      Top             =   0
      Width           =   1755
      _ExtentX        =   3096
      _ExtentY        =   688
      ButtonWidth     =   609
      ButtonHeight    =   582
      Appearance      =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   5
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "arrow"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "zoomin"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "zoomout"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "pan"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "globe"
            ImageIndex      =   5
         EndProperty
      EndProperty
   End
   Begin MapObjects2.Map Map1 
      Height          =   5895
      Left            =   2040
      TabIndex        =   0
      Top             =   360
      Width           =   5535
      _Version        =   131072
      _ExtentX        =   9763
      _ExtentY        =   10398
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form1.frx":055A
   End
   Begin VB.Menu mnuFile 
      Caption         =   "文件"
      Begin VB.Menu mnuOpen 
         Caption         =   "打开"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim dCON As New MapObjects2.DataConnection
Dim sFile As String
Dim sFileTitle As String
Dim FileWay As String
Dim i As Integer
Dim j As Integer
Dim curLayer As New MapObjects2.MapLayer


Private Sub Form_Load()
j = 0
   ListView1.ColumnHeaders.Add , , "图层", ListView1.Width
   ListView1.View = lvwReport
End Sub

Private Sub Form_Resize()
'Map1.Width = Form1.Width * 0.72
'Map1.Left = Form1.Width * 0.28
'Map1.Height = Form1.Height - 800
'Map1.Top = 800
'ListView1.Width = Form1.Width * 0.28
'ListView1.Left = 0
'ListView1.Height = Form1.Height - 800
'ListView1.Top = 800

End Sub

Private Sub ListView1_ItemCheck(ByVal Item As MSComctlLib.ListItem)

'If Item.Checked = True Then
'    curLayer.Visible = True
'Else
'    curLayer.Visible = False
'End If

End Sub

Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    If j = 2 Then
        Set Map1.Extent = Map1.TrackRectangle
    ElseIf j = 4 Then
        Map1.Pan
'    ElseIf j = 5 Then
'       Set Map1.Extent = Map1.FullExtent
    End If
End If
End Sub

Private Sub mnuOpen_Click()
    i = i + 1
    
    
    With CommonDialog1
        .DialogTitle = "打开"
        .CancelError = False
        'ToDo: 设置 common dialog 控件的标志和属性
        .Filter = "SHP文件 (*.SHP)|*.SHP"
        .ShowOpen
        If Len(.FileName) = 0 Then
            Exit Sub
        End If
        sFile = .FileName
        sFileTitle = .FileTitle
    End With
    
    FindWay sFile, sFileTitle, FileWay
    
    dCON.Database = FileWay
    Set curLayer = New MapLayer
    curLayer.GeoDataset = dCON.FindGeoDataset(sFileTitle)
    
    Map1.Layers.Add curLayer
    ListView1.ListItems.Add , , curLayer.Name
    ListView1.ListItems(i).Checked = True
    
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key

Case "arrow"
    Map1.Refresh
    j = 0
Case "zoomin"
     j = 2
Case "zoomout"
    j = 3
Case "pan"
    j = 4
Case "globe"
    Set Map1.Extent = Map1.FullExtent
    

End Select

End Sub

⌨️ 快捷键说明

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