?? +
字號:
VERSION 5.00
Begin VB.Form frmCalculate
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "滑動平均"
ClientHeight = 1335
ClientLeft = 165
ClientTop = 555
ClientWidth = 4455
LinkTopic = "Form1"
ScaleHeight = 2.355
ScaleMode = 7 'Centimeter
ScaleWidth = 7.858
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox txtData
Alignment = 2 'Center
Appearance = 0 'Flat
Height = 270
Index = 0
Left = 120
TabIndex = 7
Text = "txtData"
Top = 1080
Visible = 0 'False
Width = 855
End
Begin VB.CommandButton cmdSaveE
Caption = "保存殘差"
Height = 375
Left = 2280
TabIndex = 6
Top = 720
Width = 975
End
Begin VB.OptionButton opt3_5
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "三次五點"
ForeColor = &H80000008&
Height = 375
Left = 3240
TabIndex = 5
Top = 240
Width = 1095
End
Begin VB.OptionButton opt1_5
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "一次五點"
ForeColor = &H80000008&
Height = 375
Left = 1680
TabIndex = 4
Top = 240
Value = -1 'True
Width = 1095
End
Begin VB.OptionButton opt1_3
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "一次三點"
ForeColor = &H80000008&
Height = 375
Left = 120
TabIndex = 3
Top = 240
Width = 1095
End
Begin VB.CommandButton cmdExit
Caption = "退 出"
Height = 375
Left = 3360
TabIndex = 2
Top = 720
Width = 975
End
Begin VB.CommandButton cmdSaveR
Caption = "保存結果"
Height = 375
Left = 1200
TabIndex = 1
Top = 720
Width = 975
End
Begin VB.CommandButton cmdCalculate
Caption = "計 算"
Height = 375
Left = 120
TabIndex = 0
Top = 720
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 = 2280
TabIndex = 9
Top = 1080
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 = 1200
TabIndex = 8
Top = 1080
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 FileSave(strName As String)
Dim intNumber As Integer
Dim vntA As Variant
MsgBox "現在存盤,請耐心等待!"
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 '關閉文件
MsgBox "存盤完成,請繼續進行!"
End Sub
Private Sub Form_Load()
cmdSaveR.Visible = False '“保存數據”命令按鈕不可視
cmdSaveE.Visible = False '“保存殘差”命令按鈕不可視
Dim vntA As Variant
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
End Sub
'調用滑動平均過程計算
Private Sub cmdCalculate_Click()
If opt1_3 Then Smooth_1_3 P, R, E '一次三點
If opt1_5 Then Smooth_1_5 P, R, E '一次五點
If opt3_5 Then Smooth_3_5 P, R, E '三次五點
cmdSaveR.Visible = True '“保存結果”命令按鈕可視
cmdSaveE.Visible = True '“保存殘差”命令按鈕可視
End Sub
'將平滑結果保存為數據文件
Private Sub cmdSaveR_Click()
Dim sngR As Single
For intI = intRowAll - intRow + 1 To intRowAll
For intJ = 1 To intCol
sngR = R(intI - intRowAll + intRow, intJ)
txtData((intI - 1) * intCol + intJ) = sngR
Next intJ
Next intI
FileSave (strSmo_Name)
End Sub
'將平滑殘差保存為數據文件
Private Sub cmdSaveE_Click()
Dim sngE As Single
For intI = intRowAll - intRow + 1 To intRowAll
For intJ = 1 To intCol
sngE = E(intI - intRowAll + intRow, intJ)
txtData((intI - 1) * intCol + intJ) = sngE
Next intJ
Next intI
FileSave (strErr_Name)
End Sub
'退出
Private Sub cmdExit_Click()
Unload Me
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -