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

📄 frmnewprojectselection.frm

📁 Data monkey是一个强大的是数据传输和转换应用程序。使用DataMonkey用户可以把复杂的文本文件格式
💻 FRM
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmNewProjectSelection 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "New Project"
   ClientHeight    =   4596
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   5580
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4596
   ScaleWidth      =   5580
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton btnCancel 
      Cancel          =   -1  'True
      Caption         =   "&Cancel"
      Height          =   375
      Left            =   3540
      TabIndex        =   1
      Top             =   4080
      Width           =   855
   End
   Begin VB.CommandButton btnOk 
      Caption         =   "&Ok"
      Default         =   -1  'True
      Height          =   375
      Left            =   4560
      TabIndex        =   0
      Top             =   4080
      Width           =   855
   End
   Begin MSComDlg.CommonDialog dlgCommon 
      Left            =   1260
      Top             =   4020
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      CancelError     =   -1  'True
      DialogTitle     =   "Select Template File"
      Filter          =   "Template Files (*.tpl)|*.tpl|All Files (*.*)|*.*"
   End
   Begin VB.Frame fraTabs 
      BorderStyle     =   0  'None
      Height          =   3135
      Index           =   0
      Left            =   180
      TabIndex        =   4
      Top             =   720
      Width           =   5175
      Begin ComctlLib.ListView lstItems 
         Height          =   3015
         Left            =   60
         TabIndex        =   5
         Top             =   60
         Width           =   5055
         _ExtentX        =   8911
         _ExtentY        =   5313
         Arrange         =   2
         LabelEdit       =   1
         Sorted          =   -1  'True
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   327682
         Icons           =   "ImageList1"
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   0
         NumItems        =   1
         BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            Key             =   ""
            Object.Tag             =   ""
            Text            =   ""
            Object.Width           =   2540
         EndProperty
      End
   End
   Begin ComctlLib.TabStrip tab 
      Height          =   3555
      Left            =   120
      TabIndex        =   3
      Top             =   360
      Width           =   5295
      _ExtentX        =   9335
      _ExtentY        =   6265
      _Version        =   327682
      BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
         NumTabs         =   2
         BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "Blank projects"
            Key             =   ""
            Object.Tag             =   ""
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "Wizard templates"
            Key             =   ""
            Object.Tag             =   ""
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin VB.Frame fraTabs 
      BorderStyle     =   0  'None
      Height          =   3135
      Index           =   1
      Left            =   180
      TabIndex        =   6
      Top             =   720
      Width           =   5175
      Begin ComctlLib.ListView lstTemplates 
         Height          =   2535
         Left            =   60
         TabIndex        =   7
         Top             =   60
         Width           =   5055
         _ExtentX        =   8911
         _ExtentY        =   4466
         Arrange         =   2
         LabelEdit       =   1
         Sorted          =   -1  'True
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   327682
         Icons           =   "ImageList1"
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   0
         NumItems        =   1
         BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            Key             =   ""
            Object.Tag             =   ""
            Text            =   ""
            Object.Width           =   2540
         EndProperty
      End
      Begin VB.CommandButton btnBrowseForTemplates 
         Caption         =   "&Browse..."
         Height          =   375
         Left            =   4200
         TabIndex        =   8
         Top             =   2700
         Width           =   915
      End
   End
   Begin VB.Label Label1 
      Caption         =   "Create new project from"
      Height          =   195
      Left            =   180
      TabIndex        =   2
      Top             =   60
      Width           =   1815
   End
   Begin ComctlLib.ImageList ImageList1 
      Left            =   2700
      Top             =   3960
      _ExtentX        =   995
      _ExtentY        =   995
      BackColor       =   -2147483643
      ImageWidth      =   32
      ImageHeight     =   32
      MaskColor       =   12632256
      _Version        =   327682
      BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
         NumListImages   =   4
         BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "frmNewProjectSelection.frx":0000
            Key             =   "BlankForm"
         EndProperty
         BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "frmNewProjectSelection.frx":031A
            Key             =   "TemplateForm"
         EndProperty
         BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "frmNewProjectSelection.frx":0634
            Key             =   "WizardForm"
         EndProperty
         BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "frmNewProjectSelection.frx":094E
            Key             =   ""
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frmNewProjectSelection"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' DataMonkey Data Conversion Application. Written by Theodore L. Ward
' Copyright (C) 2002 AstroComma Incorporated.
'
' This program is free software; you can redistribute it and/or
' modify it under the terms of the GNU General Public License
' as published by the Free Software Foundation; either version 2
' of the License, or (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software
' Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
' The author may be contacted at:
' TheodoreWard@Hotmail.com or TheodoreWard@Yahoo.com

Option Explicit
Dim mSelectedIndex As Integer
Dim mOutputSources(1 To 2, 1 To 100) As String
Dim mNumOutputSources As Integer
Dim mSelectionType As eNewProjectSelectionType

Enum eNewProjectSelectionType
    npstBlankProject
    npstWizard
    npstTemplate
End Enum

Public Function GetSelectionType() As String
    GetSelectionType = mSelectionType
End Function

Public Sub GetSelectedTemplateInfo(fileName As String, name As String)
    If mSelectedIndex < 0 Then Exit Sub
    
    fileName = mOutputSources(1, mSelectedIndex)
    name = mOutputSources(2, mSelectedIndex)
End Sub

Private Sub btnBrowseForTemplates_Click()
    On Error GoTo eHandler
    
    Dim name As String
    Dim i As Integer
    
    ' Get the filename.
    fMainForm.dlgTemplateDialog.ShowOpen

    ' Get the name of the new item.
    If GetTemplateName(fMainForm.dlgTemplateDialog.fileName, name) Then
        
        ' Make sure this item isn't already in our list.
        For i = 1 To Me.lstTemplates.ListItems.Count
            If lstTemplates.ListItems(i).Text = name Then
                MsgBox "The template " & name & " is already in the list", vbOKOnly Or vbInformation, "Error"
                Exit Sub
            End If
        Next i
        
        ' Store the new filename and schema name.
        mNumOutputSources = mNumOutputSources + 1
        mOutputSources(1, mNumOutputSources) = fMainForm.dlgTemplateDialog.fileName
        mOutputSources(2, mNumOutputSources) = name
        
        Dim li As ListItem
        Set li = lstTemplates.ListItems.Add(, , name, "TemplateForm")
        li.tag = mNumOutputSources
        Set li = Nothing
    End If
eHandler:

End Sub

Private Sub btnCancel_Click()
    mSelectionType = -1
    Me.Hide
End Sub

Private Sub btnOk_Click()
    
    mSelectionType = -1
    mSelectedIndex = -1

    If fraTabs(0).Visible = True Then
        If Not Me.lstItems.SelectedItem Is Nothing Then
            mSelectionType = lstItems.SelectedItem.tag
        End If
    ElseIf fraTabs(1).Visible = True Then
        If Not Me.lstTemplates.SelectedItem Is Nothing Then
            mSelectionType = eNewProjectSelectionType.npstTemplate
            mSelectedIndex = lstTemplates.SelectedItem.tag
        End If
    End If
    
    GFormReturnValue = vbOK
    Me.Hide
End Sub

Private Sub Form_Load()
    mSelectedIndex = -1
    
    lstItems.ColumnHeaders(1).Width = lstItems.Width
    lstTemplates.ColumnHeaders(1).Width = lstTemplates.Width
    
    GFormReturnValue = vbCancel

    Me.left = (Screen.Width - Me.Width) / 2
    Me.top = (Screen.Height - Me.Height) / 2
    
    Dim item As ListItem
    
    Set item = lstItems.ListItems.Add(, , "Blank Project", "BlankForm")
    item.tag = eNewProjectSelectionType.npstBlankProject
    
    Set item = lstItems.ListItems.Add(, , "Project Wizard", "WizardForm")
    item.tag = eNewProjectSelectionType.npstWizard
    
    FillTemplateBox
    
    Set Me.Tab.SelectedItem = Me.Tab.Tabs(1)
    Call tab_Click
    
End Sub

Private Sub FillTemplateBox()
    Dim i As Integer
    Dim item As ListItem
    
    mSelectedIndex = -1
    With Me.lstTemplates.ListItems
        
        ' Clear the output sources list.
        .Clear
        
        ' Add all the available output sources to the list control.
        mNumOutputSources = GetTemplates(mOutputSources)

        For i = 1 To mNumOutputSources
            Set item = .Add(, , mOutputSources(2, i), "TemplateForm")
            item.tag = i
        Next i
    End With

End Sub

Private Function GetTemplates(arr() As String) As Integer
    Dim Path As String
    Dim fileName As String
    Dim SourceName As String
    Dim i As Integer
    
    GetTemplates = 0
    i = 0
    
    fileName = Dir(GTemplateDirectory & "\*.tpl", vbNormal)
    Do While fileName <> ""
        fileName = GTemplateDirectory & "\" & fileName
        
        ' Get the official source name.
        If GetTemplateName(fileName, SourceName) Then

            i = i + 1
            If i > UBound(arr, 2) Then
                ReDim Preserve arr(2, i + 10)
            End If
                
            arr(1, i) = fileName
            arr(2, i) = SourceName
        End If

        fileName = Dir
    Loop
    GetTemplates = i
    Exit Function

eHandler:
    LogError "frmNewProjectSelection", "GetTemplates", Error(Err), False

End Function

' This function reads the name of an output source from
' the given output source file.
Function GetTemplateName(fileName As String, ByRef ReturnName As String) As Boolean
    On Error GoTo eHandler
    GetTemplateName = False
    
    Dim arc As New CArchive
    Dim item As String, value As Variant, retVal As Integer

    arc.fileName = fileName
    If Not arc.OpenFile(False) Then Exit Function
    
    ' Read from the input file until we find the name.
    Do
        retVal = arc.GetNextItem(item, value)
        If item = "NAME" Then
            ReturnName = value
            GetTemplateName = True
            arc.CloseFile
            Exit Function
        End If
    Loop While retVal <> cENDITEM And retVal <> cERROR
    
    LogError "frmNewProjectSelection", "GetTemplateName", fileName + " Is not a valid Wizard Template file", False
    Exit Function
eHandler:
    LogError "frmNewProjectSelection", "GetTemplateName", Error(Err), False
End Function

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If UnloadMode = vbFormControlMenu Then
        Cancel = 1
        Me.Hide
    End If
End Sub

Private Sub lstItems_DblClick()
    If lstItems.SelectedItem Is Nothing Then Exit Sub
    Call btnOk_Click
End Sub

Private Sub lstTemplates_DblClick()
    If lstTemplates.SelectedItem Is Nothing Then Exit Sub
    Call btnOk_Click
End Sub

Private Sub lstTemplates_ItemClick(ByVal item As ComctlLib.ListItem)
    mSelectedIndex = item.tag
End Sub

Private Sub tab_Click()
    Dim i As Integer
    
    For i = 0 To fraTabs.Count - 1
        fraTabs(i).Visible = False
    Next
    
    fraTabs(Me.Tab.SelectedItem.index - 1).Visible = True
    fraTabs(Me.Tab.SelectedItem.index - 1).ZOrder 0

End Sub

⌨️ 快捷键说明

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