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

📄 曲面_网格f2.frm

📁 <VB数理统计实用算法>书中的算法源程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmCalculate 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   Caption         =   "曲面_网格"
   ClientHeight    =   2415
   ClientLeft      =   165
   ClientTop       =   555
   ClientWidth     =   4500
   LinkTopic       =   "Form1"
   ScaleHeight     =   4.26
   ScaleMode       =   7  'Centimeter
   ScaleWidth      =   7.938
   StartUpPosition =   3  '窗口缺省
   Begin VB.ComboBox Combo1 
      Height          =   300
      ItemData        =   "曲面_网格F2.frx":0000
      Left            =   2160
      List            =   "曲面_网格F2.frx":001C
      TabIndex        =   11
      Text            =   "I型"
      Top             =   360
      Width           =   2175
   End
   Begin VB.TextBox txtN 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      Height          =   270
      Left            =   720
      TabIndex        =   9
      Top             =   1200
      Width           =   735
   End
   Begin VB.ListBox List1 
      Appearance      =   0  'Flat
      Height          =   390
      ItemData        =   "曲面_网格F2.frx":00A6
      Left            =   240
      List            =   "曲面_网格F2.frx":00B0
      TabIndex        =   7
      Top             =   360
      Width           =   1695
   End
   Begin VB.TextBox txtData 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   0
      Left            =   840
      TabIndex        =   3
      Text            =   "txtData"
      Top             =   2040
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退  出"
      Height          =   375
      Left            =   1680
      TabIndex        =   2
      Top             =   1680
      Width           =   975
   End
   Begin VB.CommandButton cmdSaveR 
      Caption         =   "保  存"
      Height          =   375
      Left            =   2640
      TabIndex        =   1
      Top             =   1680
      Width           =   975
   End
   Begin VB.CommandButton cmdCalculate 
      Caption         =   "计  算"
      Height          =   375
      Left            =   720
      TabIndex        =   0
      Top             =   1680
      Width           =   975
   End
   Begin VB.Label lblResult 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   2760
      TabIndex        =   13
      Top             =   1200
      Width           =   855
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "插值结果"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   2520
      TabIndex        =   12
      Top             =   960
      Width           =   1335
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "选择加权类型"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   2280
      TabIndex        =   10
      Top             =   120
      Width           =   1815
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "给出近点数"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   240
      TabIndex        =   8
      Top             =   960
      Width           =   1695
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "选择方法"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   360
      TabIndex        =   6
      Top             =   120
      Width           =   1455
   End
   Begin VB.Label lblCol 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "lblCol"
      ForeColor       =   &H80000008&
      Height          =   255
      Index           =   0
      Left            =   2640
      TabIndex        =   5
      Top             =   2040
      Visible         =   0   'False
      Width           =   975
   End
   Begin VB.Label lblRow 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "lblRow"
      ForeColor       =   &H80000008&
      Height          =   255
      Index           =   0
      Left            =   1680
      TabIndex        =   4
      Top             =   2040
      Visible         =   0   'False
      Width           =   975
   End
End
Attribute VB_Name = "frmCalculate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'曲面_网格的计算窗体
Dim intI As Integer, intJ As Integer

Private Sub Form_Load()
    Dim vntA As Variant
    cmdSaveR.Visible = False                    '“保存”命令按钮不可视
    intFileNumber = FreeFile                    '取得文件号码
    Open strFileName For Input As intFileNumber '打开文件
'形成文本框数组,但不在窗体上显示
    For intI = 1 To intRowAll
        For intJ = 1 To intCol
            Input #intFileNumber, vntA
            Load txtData((intI - 1) * intCol + intJ)
            txtData((intI - 1) * intCol + intJ).Text = vntA
        Next intJ
    Next intI
'形成上部标签,但不在窗体上显示
    For intI = 1 To intCol
        Input #intFileNumber, vntA
        Load lblCol(intI)
        lblCol(intI).Caption = vntA
    Next intI
'形成左边标签,但不在窗体上显示
    For intI = 1 To intRowAll
        Input #intFileNumber, vntA
        Load lblRow(intI)
        lblRow(intI).Caption = vntA
    Next intI
    Close
    List1.ListIndex = 0     '近点按距离加权为缺省方法
    Combo1.ListIndex = 0    '用加权最小二乘拟合法时I型为缺省设置
    If frmFileName.Option1 Then
'网格化时不用显示插值结果的标签
        Label4.Visible = False
        lblResult.Visible = False
    End If
'先不显示组合框(选择加权最小二乘拟合法类型时使用)
    Label3.Visible = False
    Combo1.Visible = False
End Sub

'计算
Private Sub cmdCalculate_Click()
    Dim F As Double, FF As Single
    If frmFileName.Option2 Then
'List1.ListIndex = 0用近点按距离加权平均法
        If List1.ListIndex = 0 Then NDS X, Y, Z, A, B, F, Val(txtN)
'List1.ListIndex = 1用加权最小二乘拟合法
        If List1.ListIndex = 1 Then WLSA X, Y, Z, A, B, F, Combo1.ListIndex
        FF = F
        lblResult.Caption = Str(FF)  '显示计算结果
    Else
        ReDim G(1 To M, 1 To N)
'List1.ListIndex给定方法
'Val(txtN)给定点数
'Combo1.ListIndex给定类型
        GRID X, Y, G, List1.ListIndex, Val(txtN), Combo1.ListIndex
        cmdSaveR.Visible = True    '“保存”命令按钮可视
    End If
End Sub

'保存文件过程
Private Sub FileSave(strName As String)
    Dim intNumber As Integer
    Dim vntA As Variant
    intNumber = FreeFile                            '取得空闲的文件号
    Open strName For Output As intNumber            '打开文件
'保存数据
    For intI = 1 To intRowAll
        For intJ = 1 To intCol
            Write #intNumber, txtData((intI - 1) * intCol + intJ);
        Next intJ
    Next intI
'保存上部标签
    For intI = 1 To intCol
        Write #intNumber, lblCol(intI).Caption;
    Next intI
'保存左边标签
    For intI = 1 To intRowAll
        Write #intNumber, lblRow(intI).Caption;
    Next intI
    Close                                           '关闭文件
End Sub

'将计算结果保存为数据文件
Private Sub cmdSaveR_Click()
    Dim sngR As Single, intN As Integer
    MsgBox "现在存盘,请耐心等待!"
'重新建立网格体系,需要先卸载原有的网格体系
    For intI = 1 To intRowAll
        For intJ = 1 To intCol
            Unload txtData((intI - 1) * intCol + intJ)
        Next intJ
    Next intI
    For intI = 1 To intCol
        Unload lblCol(intI)
    Next intI
    For intI = 1 To intRowAll
        Unload lblRow(intI)
    Next intI
'保存网格化数据
'网格化时的列数、行数、总行数都有可能改变,需要重新建立网格体系
'重新取得列数、行数、总行数
    intRow = M
    If blnRowLabel Then
        intRowAll = intRowAll - 6 + 2 * M
    Else
        intRowAll = intRowAll - 3 + M
    End If
    intCol = N
    For intI = 1 To intRowAll
        For intJ = 1 To intCol
            Load txtData((intI - 1) * intCol + intJ)
        Next intJ
    Next intI
    For intI = 1 To intCol
        Load lblCol(intI)
    Next intI
    For intI = 1 To intRowAll
        Load lblRow(intI)
    Next intI
    lblRow(1).Caption = "列数"
    txtData(1).Text = intCol                            '列数
    For intI = 2 To intCol
        txtData(intI) = "*******"
    Next intI
    lblRow(2).Caption = "行数"
    txtData(intCol + 1).Text = intRow                   '行数
    For intI = 2 To intCol
        txtData(intCol + intI) = "*******"
    Next intI
    lblRow(3).Caption = "总行数"
    txtData(2 * intCol + 1).Text = intRowAll            '总行数
    For intI = 2 To intCol
        txtData(2 * intCol + intI) = "*******"
    Next intI
    If blnTitle Then                                    '有标题
        lblRow(4).Caption = "标题"
        txtData(3 * intCol + 1).Text = "网格插值"
        For intI = 2 To intCol
            txtData(3 * intCol + intI) = "*******"
        Next intI
        intN = 5
    End If
    If blnRowLabel Then                                 '有行标
        For intI = intN To intN + intRow - 1
            lblRow(intI).Caption = "行标" & (intI - intN + 1)
            txtData((intI - 1) * intCol + 1).Text = " "
            For intJ = 2 To intCol
                txtData((intI - 1) * intCol + intJ).Text = "*******"
            Next intJ
        Next intI
        intN = intN + intRow
    End If
    If blnColLabel Then                                 '有列标
        lblRow(intN).Caption = "列标"
        For intI = 1 To intCol
            txtData((intN - 1) * intCol + intI) = " "
        Next intI
        intN = intN + 1
    End If
    For intI = intN To intRowAll
        lblRow(intI).Caption = "第" & (intI - intN + 1) & "行"
        For intJ = 1 To intCol
            sngR = G(intI - intN + 1, intJ)
            txtData((intI - 1) * intCol + intJ) = sngR  '数据
        Next intJ
    Next intI
    For intI = 1 To intCol
        lblCol(intI).Caption = "第" & intI & "列"
    Next intI
    FileSave (strRes_Name)
    MsgBox "存盘完成,请继续进行!"
End Sub

Private Sub List1_Click()
    If List1.ListIndex = 0 Then
'近点按距离加权为缺省方法
        Label2.Visible = True
        txtN.Visible = True     '需要给出点数
        Label3.Visible = False
        Combo1.Visible = False
    Else
'最小二乘加权拟合
        Label2.Visible = False
        txtN.Visible = False    '不用给出点数
'显示组合框(选择加权最小二乘拟合法类型时使用)
        Label3.Visible = True
        Combo1.Visible = True
    End If
End Sub

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


⌨️ 快捷键说明

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