frmviewentirelayer.frm

来自「GIS地理信息系统开发。大名鼎鼎的MAPX+VisualBasic6.0软件开发」· FRM 代码 · 共 93 行

FRM
93
字号
VERSION 5.00
Begin VB.Form frmViewEntireLayer 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "View Entire Layer"
   ClientHeight    =   1755
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   3570
   Icon            =   "frmViewEntireLayer.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1755
   ScaleWidth      =   3570
   ShowInTaskbar   =   0   'False
   Begin VB.ComboBox LayerCombo 
      Height          =   315
      Left            =   240
      Style           =   2  'Dropdown List
      TabIndex        =   2
      Top             =   480
      Width           =   3135
   End
   Begin VB.CommandButton CancelButton 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   1800
      TabIndex        =   1
      Top             =   1080
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "OK"
      Default         =   -1  'True
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   1080
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "View Entire Layer:"
      Height          =   255
      Left            =   240
      TabIndex        =   3
      Top             =   240
      Width           =   1695
   End
End
Attribute VB_Name = "frmViewEntireLayer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' This sample application and corresponding sample code is provided
' for example purposes only.  It has not undergone rigorous testing
' and as such should not be shipped as part of a final application
' without extensive testing on the part of the organization releasing
' the end-user product.

Private Sub CancelButton_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Dim lyr As MapXLib.Layer
    For Each lyr In fMainForm.Map1.Layers
        LayerCombo.AddItem lyr.Name
    Next
    LayerCombo.AddItem "All Layers"
    LayerCombo.ListIndex = 1
End Sub

Private Sub OKButton_Click()
    ' Since layer bounds are expressed in the NumericCoordSys and
    ' map bounds are expressed in the DisplayCoordSys, we make the
    ' coordinate systems identical here. If we didn't, the new view
    ' would be incorrect
    Set fMainForm.Map1.NumericCoordSys = fMainForm.Map1.DisplayCoordSys
    
    If LayerCombo.Text = "All Layers" Then
        Set fMainForm.Map1.Bounds = fMainForm.Map1.Layers.Bounds
    Else
        Dim LayerName As String
        LayerName = LayerCombo.Text
        Set fMainForm.Map1.Bounds = fMainForm.Map1.Layers(LayerName).Bounds
    End If
    Unload Me
End Sub

⌨️ 快捷键说明

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