www.pudn.com > MapX5Demo.rar > frmPackOption.frm, change:2002-09-22,size:3882b


VERSION 5.00 
Begin VB.Form frmPackOption  
   BorderStyle     =   3  'Fixed Dialog 
   Caption         =   "紧缩表选项" 
   ClientHeight    =   3195 
   ClientLeft      =   45 
   ClientTop       =   330 
   ClientWidth     =   4680 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   3195 
   ScaleWidth      =   4680 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   1  'CenterOwner 
   Begin VB.CommandButton cmdCancel  
      Caption         =   "退出" 
      Height          =   400 
      Left            =   2640 
      TabIndex        =   5 
      Top             =   2400 
      Width           =   1200 
   End 
   Begin VB.CommandButton cmdPack  
      Caption         =   "紧缩表" 
      Height          =   400 
      Left            =   720 
      TabIndex        =   4 
      Top             =   2400 
      Width           =   1200 
   End 
   Begin VB.ListBox lstPackOption  
      Height          =   1035 
      ItemData        =   "frmPackOption.frx":0000 
      Left            =   1560 
      List            =   "frmPackOption.frx":001C 
      MultiSelect     =   2  'Extended 
      TabIndex        =   3 
      Top             =   960 
      Width           =   2775 
   End 
   Begin VB.ComboBox cbPackLayers  
      Height          =   315 
      Left            =   1560 
      TabIndex        =   1 
      Top             =   240 
      Width           =   2775 
   End 
   Begin VB.Label Label2  
      Caption         =   "选项:" 
      Height          =   255 
      Left            =   240 
      TabIndex        =   2 
      Top             =   1000 
      Width           =   1095 
   End 
   Begin VB.Label Label1  
      Caption         =   "可紧缩的表:" 
      Height          =   255 
      Left            =   240 
      TabIndex        =   0 
      Top             =   270 
      Width           =   1215 
   End 
End 
Attribute VB_Name = "frmPackOption" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
'******************************************************************************** 
'File Name   :frmPackOption.frm 
'Description :set packing parameter and packing a layer 
'Author      :James Liu 
'Copyright   :MapInfo China 
'Create Date :2002年9月11日 
'******************************************************************************** 
 
Private Sub cmdCancel_Click() 
    Unload Me 
End Sub 
 
Private Sub cmdPack_Click() 
Dim oLayer As MapXLib.Layer 
Dim iPackOption As Integer 
Dim i As Integer 
 
On Error Resume Next 
     
    If lstPackOption.SelCount = 0 Then 
        MsgBox "请选择表紧缩参数。" 
        Exit Sub 
    End If 
     
    iPackOption = 0 
    For i = 0 To lstPackOption.ListCount - 1 
        If lstPackOption.Selected(i) Then 
            iPackOption = iPackOption + lstPackOption.ItemData(i) 
        End If 
    Next i 
     
    Set oLayer = frmMain.Map.Layers(Trim(cbPackLayers.Text)) 
     
    If oLayer.SupportsPack(iPackOption) = False Then 
        MsgBox "选择图层不支持指定紧缩操作!" 
        Exit Sub 
    End If 
     
    If MsgBox("紧缩表可能需要较长时间,请耐心等待!", vbOKCancel, "紧缩表") = vbOK Then 
        Screen.MousePointer = vbHourglass 
        oLayer.Pack iPackOption 
        MsgBox "完成对" & cbPackLayers.Text & "的紧缩操作!" 
        Screen.MousePointer = vbDefault 
    End If 
End Sub 
 
Private Sub Form_Load() 
 
Dim oLayer As MapXLib.Layer 
 
    For Each oLayer In frmMain.Map.Layers 
'        If oLayer.SupportsPack() Then 
            cbPackLayers.AddItem oLayer.Name 
'        End If 
    Next oLayer 
     
    If cbPackLayers.ListCount > 0 Then 
        cbPackLayers.ListIndex = 0 
        cmdPack.Enabled = True 
    Else 
        cmdPack.Enabled = False 
    End If 
     
End Sub