?? 曲面_網(wǎng)格f2.frm
字號:
VERSION 5.00
Begin VB.Form frmCalculate
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "曲面_網(wǎng)格"
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 = "曲面_網(wǎng)格F2.frx":0000
Left = 2160
List = "曲面_網(wǎng)格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 = "曲面_網(wǎng)格F2.frx":00A6
Left = 240
List = "曲面_網(wǎng)格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 = "插值結(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 = 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 = "給出近點數(shù)"
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
'曲面_網(wǎng)格的計算窗體
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 '打開文件
'形成文本框數(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 = 0 '近點按距離加權為缺省方法
Combo1.ListIndex = 0 '用加權最小二乘擬合法時I型為缺省設置
If frmFileName.Option1 Then
'網(wǎng)格化時不用顯示插值結(jié)果的標簽
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) '顯示計算結(jié)果
Else
ReDim G(1 To M, 1 To N)
'List1.ListIndex給定方法
'Val(txtN)給定點數(shù)
'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 '打開文件
'保存數(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 '關閉文件
End Sub
'將計算結(jié)果保存為數(shù)據(jù)文件
Private Sub cmdSaveR_Click()
Dim sngR As Single, intN As Integer
MsgBox "現(xiàn)在存盤,請耐心等待!"
'重新建立網(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ù)、行數(shù)、總行數(shù)
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 = "列數(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 = "網(wǎng)格插值"
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 '數(shù)據(jù)
Next intJ
Next intI
For intI = 1 To intCol
lblCol(intI).Caption = "第" & intI & "列"
Next intI
FileSave (strRes_Name)
MsgBox "存盤完成,請繼續(xù)進行!"
End Sub
Private Sub List1_Click()
If List1.ListIndex = 0 Then
'近點按距離加權為缺省方法
Label2.Visible = True
txtN.Visible = True '需要給出點數(shù)
Label3.Visible = False
Combo1.Visible = False
Else
'最小二乘加權擬合
Label2.Visible = False
txtN.Visible = False '不用給出點數(shù)
'顯示組合框(選擇加權最小二乘擬合法類型時使用)
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 + -