?? ÷
字號:
VERSION 5.00
Begin VB.Form frmCalculate
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "曲線_插值"
ClientHeight = 2175
ClientLeft = 165
ClientTop = 555
ClientWidth = 5160
LinkTopic = "Form1"
ScaleHeight = 3.836
ScaleMode = 7 'Centimeter
ScaleWidth = 9.102
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Alignment = 2 'Center
Appearance = 0 'Flat
Height = 270
Left = 3120
TabIndex = 9
Top = 600
Width = 1815
End
Begin VB.ListBox List1
Appearance = 0 'Flat
Height = 1110
ItemData = "曲線_插值F2.frx":0000
Left = 1200
List = "曲線_插值F2.frx":0016
TabIndex = 7
Top = 480
Width = 1695
End
Begin VB.TextBox txtData
Alignment = 2 'Center
Appearance = 0 'Flat
Height = 270
Index = 0
Left = 120
TabIndex = 4
Text = "txtData"
Top = 120
Visible = 0 'False
Width = 975
End
Begin VB.CommandButton cmdExit
Caption = "退 出"
Height = 375
Left = 2040
TabIndex = 2
Top = 1680
Width = 975
End
Begin VB.CommandButton cmdSaveR
Caption = "保 存"
Height = 375
Left = 3000
TabIndex = 1
Top = 1680
Width = 975
End
Begin VB.CommandButton cmdCalculate
Caption = "計 算"
Height = 375
Left = 1080
TabIndex = 0
Top = 1680
Width = 975
End
Begin VB.Label Label2
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "插值結(jié)果"
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 = 3480
TabIndex = 8
Top = 360
Width = 1215
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 = 1440
TabIndex = 6
Top = 240
Width = 1215
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 = 120
TabIndex = 5
Top = 360
Visible = 0 'False
Width = 975
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 = 120
TabIndex = 3
Top = 600
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()
cmdSaveR.Visible = False '“保存”命令按鈕不可視
Dim vntA As Variant
intFileNumber = FreeFile '取得文件號碼
Open strFileName For Input As intFileNumber '打開文件
'形成文本框數(shù)組
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 = 3 '缺省方法為牛頓插值法
'使顯示插值結(jié)果的文本框不可視
Label2.Visible = False
Text1.Visible = False
End Sub
'計算
Private Sub cmdCalculate_Click()
Dim F As Double, FF As Single
If frmFileName.Option2 Then
'單點插值
OneP X, Y, A, F, List1.ListIndex
'使顯示插值結(jié)果的文本框可視
Label2.Visible = True
Text1.Visible = True
FF = F '將雙精度變換成單精度
Text1.Text = Str(FF)
Else
'多點等距插值
ReDim R(1 To 2, 1 To M)
'List1.ListIndex給定方法
Equal X, Y, R, List1.ListIndex
cmdSaveR.Visible = True '“保存”命令按鈕可視
End If
End Sub
'保存文件過程
Private Sub FileSave(strName As String)
Dim intNumber As Integer
Dim vntA As Variant
MsgBox "現(xiàn)在存盤,請耐心等待!"
intNumber = FreeFile '取得空閑的文件號
Open strName For Output As intNumber '打開文件
'保存數(shù)據(jù)
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 '關(guān)閉文件
MsgBox "存盤完成,請繼續(xù)進行!"
End Sub
'將計算結(jié)果保存為數(shù)據(jù)文件
Private Sub cmdSaveR_Click()
Dim sngR As Single, intN As Integer
'重新建立網(wǎng)格體系,需要先卸載原有的網(wǎng)格體系
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
'保存網(wǎng)格化數(shù)據(jù)
'網(wǎng)格化時的列數(shù)、行數(shù)和總行數(shù)都有改變,需要重新建立網(wǎng)格體系
'行數(shù)由2行變成1行,總行數(shù)需要減2(包括一個數(shù)據(jù)行和一個行標)
intRow = 1: intRowAll = intRowAll - 2: intCol = M
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 = "列數(shù)"
txtData(1).Text = intCol '列數(shù)
For intI = 2 To intCol
txtData(intI) = "*******"
Next intI
lblRow(2).Caption = "行數(shù)"
txtData(intCol + 1).Text = intRow '行數(shù)
For intI = 2 To intCol
txtData(intCol + intI) = "*******"
Next intI
lblRow(3).Caption = "總行數(shù)"
txtData(2 * intCol + 1).Text = intRowAll '總行數(shù)
For intI = 2 To intCol
txtData(2 * intCol + intI) = "*******"
Next intI
If blnTitle Then '有標題
lblRow(4).Caption = "標題"
txtData(3 * intCol + 1).Text = "插值結(jié)果"
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
'將新X坐標做為列標,保留一位小數(shù),四舍五入
sngR = Int(R(1, intI) * 10 + 0.5) / 10
txtData((intN - 1) * intCol + intI) = sngR
Next intI
intN = intN + 1
End If
For intI = intN To intRowAll
lblRow(intI).Caption = "第" & (intI - intN + 1) & "行"
For intJ = 1 To intCol
sngR = R(2, intJ)
txtData((intI - 1) * intCol + intJ) = sngR '插值后的函數(shù)值
Next intJ
Next intI
For intI = 1 To intCol
lblCol(intI).Caption = "第" & intI & "列"
Next intI
FileSave (strRes_Name)
End Sub
'退出
Private Sub cmdExit_Click()
Unload Me
frmFileName.Visible = True
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -