regressionform.frm

来自「Polynomial fit functions === === === ==」· FRM 代码 · 共 57 行

FRM
57
字号
VERSION 5.00
Begin VB.Form RegressionForm 
   Caption         =   "click me twice"
   ClientHeight    =   9015
   ClientLeft      =   1680
   ClientTop       =   1455
   ClientWidth     =   10335
   LinkTopic       =   "Form1"
   ScaleHeight     =   9015
   ScaleWidth      =   10335
End
Attribute VB_Name = "RegressionForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Type PointType
  X As Double
  Y As Double
End Type

Dim Reg As New RegressionObject

Const R = 100
Dim P(1 To 200) As PointType

Private Sub Form_Load()
  Reg.Degree = 3
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  With Reg
    .XYAdd X, Y
    P(.XYCount).X = X
    P(.XYCount).Y = Y
    Redraw
  End With
End Sub

Private Sub Redraw()
Dim i&
  Cls
  With Reg
    For i = 1 To .XYCount
      Circle (P(i).X, P(i).Y), R
    Next i
    CurrentX = ScaleLeft
    CurrentY = .RegVal(CDbl(ScaleLeft))
    For i = ScaleLeft To ScaleWidth Step R
      Line -(i, .RegVal(CDbl(i))), vbBlue \ 2
    Next i
  End With
End Sub

⌨️ 快捷键说明

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