toolbars.frm

来自「一个vb+oracle的例子」· FRM 代码 · 共 180 行

FRM
180
字号
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form ToolBars 
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   375
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   8925
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   375
   ScaleWidth      =   8925
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   390
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   1440
      _ExtentX        =   2540
      _ExtentY        =   688
      ButtonWidth     =   609
      ButtonHeight    =   582
      Appearance      =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   4
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "选择"
            ImageIndex      =   1
            Style           =   2
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "放大"
            ImageIndex      =   2
            Style           =   2
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "缩小"
            ImageIndex      =   3
            Style           =   2
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "平移"
            ImageIndex      =   4
            Style           =   2
         EndProperty
      EndProperty
      OLEDropMode     =   1
   End
   Begin VB.ComboBox Combo2 
      Height          =   300
      Left            =   5760
      TabIndex        =   4
      Top             =   0
      Width           =   2295
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   2520
      TabIndex        =   2
      Top             =   0
      Width           =   2175
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   2400
      Top             =   1560
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   4
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "ToolBars.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "ToolBars.frx":031A
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "ToolBars.frx":0634
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "ToolBars.frx":094E
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "数据集:"
      Height          =   180
      Left            =   4920
      TabIndex        =   3
      Top             =   120
      Width           =   630
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "图层选择:"
      Height          =   180
      Left            =   1560
      TabIndex        =   1
      Top             =   120
      Width           =   810
   End
End
Attribute VB_Name = "ToolBars"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
    On Error GoTo error1
    Formmain.Map1.Layers(ToolBars.Combo1.Text).Editable = True
error1:
    Select Case Err.Number
       Case 1279
           MsgBox "只读文件不可编辑.", , "错误提示" '指shp文件
           On Error GoTo 0
    End Select
End Sub

Private Sub Form_Load()
    
    Dim i As Integer

    Me.Top = MDIForm1.Top
    Me.Left = MDIForm1.Left
    Me.Width = MDIForm1.ScaleWidth
    Me.Height = Toolbar1.ButtonHeight
       
    
    For i = 1 To Formmain.Map1.Layers.Count
      Combo1.AddItem Formmain.Map1.Layers.Item(i).name
    Next i
    
    For i = 1 To Formmain.Map1.Datasets.Count
      Combo2.AddItem Formmain.Map1.Datasets.Item(i).name
    Next i
    
    If Combo1.ListCount > 0 Then Combo1.ListIndex = 0
    If Combo2.ListCount > 0 Then Combo2.ListIndex = 0
    
    Toolbar1.Buttons.Item(1).Value = tbrPressed
    
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
 Dim i As Integer
 
 
 Select Case Button.Index
    
    Case 1
      Formmain.Map1.CurrentTool = miArrowTool
    Case 2 ' Zoom In
      Formmain.Map1.CurrentTool = ToolConstants.miZoomInTool
      'Formmain.Map1.MousePointer = miCustomCursor
      'Formmain.Map1.MouseIcon = "c:\windows\cursors\globe.ani"
     ' Formmain.Map1.MouseIcon = "c:\windows\cursors\Help_1.cur"
    Case 3 ' Zoom Out
      Formmain.Map1.CurrentTool = ToolConstants.miZoomOutTool
    Case 4 ' Pan
      Formmain.Map1.CurrentTool = ToolConstants.miPanTool
    
  End Select
  
End Sub

⌨️ 快捷键说明

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