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

📄 频数统计f1(窗体模块frmfile).frm

📁 这个程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmFile 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   Caption         =   "文件窗体"
   ClientHeight    =   6105
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5670
   LinkTopic       =   "Form1"
   ScaleHeight     =   6105
   ScaleWidth      =   5670
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox txtZon 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      Height          =   375
      Left            =   120
      TabIndex        =   15
      Top             =   4200
      Width           =   5415
   End
   Begin VB.FileListBox File2 
      Appearance      =   0  'Flat
      Height          =   750
      Left            =   120
      TabIndex        =   12
      Top             =   2280
      Width           =   2655
   End
   Begin VB.TextBox txtFre 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      Height          =   375
      Left            =   120
      TabIndex        =   11
      Top             =   4920
      Width           =   5415
   End
   Begin VB.TextBox txtDat 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      Height          =   375
      Left            =   120
      TabIndex        =   9
      Top             =   3480
      Width           =   5415
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4440
      TabIndex        =   7
      ToolTipText     =   "结束程序运行"
      Top             =   5520
      Width           =   1095
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3120
      TabIndex        =   6
      ToolTipText     =   "选择好文件并给出行数和列数后单击"
      Top             =   5520
      Width           =   1095
   End
   Begin VB.FileListBox File1 
      Appearance      =   0  'Flat
      Height          =   750
      Left            =   120
      TabIndex        =   2
      Top             =   1080
      Width           =   2655
   End
   Begin VB.DirListBox Dir1 
      Appearance      =   0  'Flat
      Height          =   2190
      Left            =   3000
      TabIndex        =   1
      Top             =   360
      Width           =   2415
   End
   Begin VB.DriveListBox Drive1 
      Appearance      =   0  'Flat
      Height          =   300
      Left            =   120
      TabIndex        =   0
      Top             =   360
      Width           =   2655
   End
   Begin VB.Label Label7 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "频数分组文件全名"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   1200
      TabIndex        =   14
      Top             =   3960
      Width           =   3255
   End
   Begin VB.Label Label6 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "选择频数分组文件"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   600
      TabIndex        =   13
      Top             =   2040
      Width           =   1695
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "保存频数统计结果的数据文件全名"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   1320
      TabIndex        =   10
      Top             =   4680
      Width           =   3015
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "数据文件全名"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   1320
      TabIndex        =   8
      Top             =   3240
      Width           =   3015
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "选择数据文件"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   120
      TabIndex        =   5
      Top             =   840
      Width           =   2535
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "选择目录"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   3000
      TabIndex        =   4
      Top             =   120
      Width           =   2415
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "选择驱动器"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   120
      TabIndex        =   3
      Top             =   120
      Width           =   2655
   End
End
Attribute VB_Name = "frmFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'文件窗体
'设置为启动窗体
Option Explicit
Dim intI As Integer, intJ As Integer, intC As Integer
Dim intDatNumber As Integer             '数据文件号
Dim intZonNumber As Integer             '频数分布文件号
Dim strData As String                   '临时保存数据

Private Sub Form_Load()
    File1.Pattern = "*.dat"             '只显示.dat数据文件
    File2.Pattern = "*.dat"             '只显示.dat频数文件
End Sub

'选择目录
Private Sub Dir1_Change()
    File1.Path = Dir1.Path
    File2.Path = Dir1.Path
End Sub

'选择驱动器
Private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
End Sub

'确定数据文件
Private Sub File1_Click()
'输入文件
    txtDat.Text = Dir1.Path & "\" & File1.FileName
    strDatName = txtDat.Text
'输出的频数统计文件
    txtFre.Text = Dir1.Path & "\" & "频数_" & File1.FileName
    strFreName = txtFre.Text
End Sub

'确定频数分布文件
Private Sub File2_Click()
    txtZon.Text = Dir1.Path & "\" & File2.FileName
    strZonName = txtZon.Text
End Sub

'确定,给出文件名后单击
Private Sub cmdOK_Click()
    Dim intRC As Integer, intZC As Integer
    intDatNumber = FreeFile                     '取得空闲的文件号码
    Open strDatName For Input As intDatNumber   '打开数据文件
    Input #intDatNumber, intRow, intCol         '读行数和列数
    intZonNumber = FreeFile                     '取得空闲的文件号码
    Open strZonName For Input As intZonNumber   '打开频数分段文件
    Input #intZonNumber, intZon, intCCC         '读行数和列数
    intRC = intRow * intCol                     '样本数
    intZC = intZon * intCCC                     '频段分组数
'重新定义数据数组
    ReDim P(1 To intRC, 1 To 2)
    ReDim S(1 To intZC, 1 To 2)
    ReDim R(1 To intZC, 1 To 2)
    For intI = 1 To intRow
        For intJ = 1 To intCol
            Input #intDatNumber, strData               '读数据,初值
            P((intI - 1) * intCol + intJ, 1) = Val(strData)
            Input #intDatNumber, strData               '读数据,终值
            P((intI - 1) * intCol + intJ, 2) = Val(strData)
        Next intJ
    Next intI
    For intI = 1 To intZon
        For intJ = 1 To intCCC
            Input #intZonNumber, strData               '读频数分组,初值
            S((intI - 1) * intCCC + intJ, 1) = Val(strData)
            Input #intZonNumber, strData               '读频数分组,终值
            S((intI - 1) * intCCC + intJ, 2) = Val(strData)
        Next intJ
    Next intI
    Close                                               '关闭文件
    Unload Me
    frmCalc.Visible = True                              '显示参数窗体
End Sub

'退出
Private Sub cmdExit_Click()
    Unload Me
    End
End Sub



⌨️ 快捷键说明

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