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

📄 main form.frm

📁 runge kutta program to test run with VB code
💻 FRM
📖 第 1 页 / 共 4 页
字号:
             End If
          Wend
          Call subfunctie(S, rez)
          If rez2 <> 0 Then
             jj = Int(1 / rez2)
          End If
          If (rez = 0) And (rez2 < 0) Then
            nedef = True
            Exit Sub
         Else
         If rez2 = 0 Then
            nedef = True
            Exit Sub
         Else
         If ((rez < 0) And ((1 / rez2) <> jj)) Then
            nedef = True
            Exit Sub
         Else
            vall = rez ^ (1 / rez2)
         End If
         End If
         End If
         i = i + Len(S) ' + 1
         subsir = ""
    Case "ln"
          ss2 = Mid(sir, i + 1, Len(sir) - i)
          Call calculurm(ss2, S)
          Call subfunctie(S, rez)
          If rez <= 0 Then
             nedef = True
             Exit Sub
          Else
             vall = Log(rez)
          End If
          i = i + Len(S)
          subsir = ""
    End Select
    If Abs(vall) > 100000 Then
       infinit = True
        If vall > 0 Then
            vall = 267
        Else
          vall = -266
        Exit Sub
        End If
    End If
Next

End Sub
Public Sub grafic()
Dim f As Double
Dim i, j, ff, incep As Integer
Dim okk, nedeft As Boolean
   Image1.Visible = False
   Image2.Visible = True
   Frame1.Visible = True
   DoEvents
   If opp(2) = False Then
      Form2.Picture1.Cls
      Form2.Picture1.Line (5, 212)-(530, 212), RGB(255, 255, 255)
      Form2.Picture1.Line (267, 5)-(267, 420), RGB(255, 255, 255)
      For i = 0 To 10
        Picture1.Line (267, 5)-(262 + i, 15), RGB(255, 255, 255)
        Picture1.Line (530, 212)-(520, 207 + i), RGB(255, 255, 255)
      Next
   End If
   Label3.Visible = True
   Label4.Visible = True
   Label5.Visible = True
   DoEvents
   startprog = False
   Text1.AddItem (t)
   If opp(3) = True Then
      Combo2.AddItem (t)
   End If
   scala = Val(Form2.Combo1.Text)
     Dim S As String
     S = "100/" + Combo1.Text + " pixels"
     Form2.Label12.Caption = S
   incep = 0
   cresc = 0
   iis = 5
   nedeft = True
   Progress.Cls
   For i = 5 To 530
       progr (i)
       X = (i - 267) * scala / 100
       nedef = False
       infinit = False
       fass = True
       Call subfunctie(t, f)
       If nedef = True Then
          nedeft = True
          iis = i + 1
       Else
         nedeft = False
         If cresc = 0 And incep = 0 Then
         End If
         If cresc = 0 And incep = 1 Then
            If ultimpoz > f Then
               cresc = 1
            Else
              If ultimpoz < f Then
                cresc = 2
              End If
            End If
         End If
         If cresc = 1 Then
            If ultimpoz > f Then
               cresc = 1
            Else
              If ultimpoz < f Then
                cresc = 2
                iis = i - 1
              End If
            End If
         End If
         If cresc = 2 Then
            If ultimpoz < f Then
               cresc = 2
            Else
              If ultimpoz > f Then
                cresc = 1
                iis = i - 1
              End If
            End If
         End If
         ultimpoz = f
       End If
       If (nedef = True) Then
          nn = 2
          If opp(1) = True Then
          For j = 1 To 41
              Form2.Picture1.PSet (i, j * 10 + (i Mod 10)), RGB(155, 255, 0)
          Next
          End If
       End If
       If (nedef = False) And (infinit = False) Then
        f = f * 100 / scala
        If (f < 1) And (f > 0) Then
            f = 1
        End If
        If (f > -1) And (f < 0) Then
            f = -1
        End If
        Form2.Picture1.PSet (i, 212 - f), RGB(0, 255, 0)
         If (f - ff > 200) Or (ff - f > 200) Then
            okk = False
          Else
            okk = True
          End If
         If nn > 0 Then
           nn = nn - 1
          End If
         If ((incep = 1) And ((ff + 1 <> f) Or (ff - 1 <> f) Or (ff <> f)) And (okk = True) And (nn = 0)) Then
                Form2.Picture1.Line (i, 212 - f)-(i - 1, 212 - ff), RGB(0, 255, 0)
         End If
       ff = f
       incep = 1
       End If
       Picture1.DataChanged = False
   Next
   Frame1.Visible = False
   DoEvents
   Image1.Visible = True
   Image2.Visible = False
End Sub
Private Sub grafica2()
Dim f As Double
Dim fff As Double
Dim i, j, kkk, ff, incep, ultim As Integer
Dim okk, inclus, max As Boolean
   Image1.Visible = False
   Image2.Visible = True
   Frame1.Visible = True
   DoEvents
   If opp(2) = False Then
      Form2.Picture1.Cls
      Form2.Picture1.Line (5, 212)-(530, 212), RGB(255, 255, 255)
      Form2.Picture1.Line (267, 5)-(267, 420), RGB(255, 255, 255)
      For i = 0 To 10
        Picture1.Line (267, 5)-(262 + i, 15), RGB(255, 255, 255)
        Picture1.Line (530, 212)-(520, 207 + i), RGB(255, 255, 255)
      Next
   End If
   Label3.Visible = True
   Label4.Visible = True
   Label5.Visible = True
   DoEvents
   startprog = False
   Text1.AddItem (t)
   If opp(3) = True Then
      Combo2.AddItem (t)
   End If
   scala = Val(Form2.Combo1.Text)
     Dim S As String
     S = "100/" + Combo1.Text + " pixels"
     Form2.Label12.Caption = S
   inclus = True
   ultim = 5
 Progress.Cls
 For kkk = 1 To 9
   incep = 0
   If inclus = True Then
      plus = 0
   Else
      plus = 1
   End If
   max = False
   If Mid(intervale(kkk), 1, 2) = "<=" Or Mid(intervale(kkk), 1, 2) = "=<" Then
      inclus = True
      Call subfunctie(Mid(intervale(kkk), 3, Len(intervale(kkk)) - 2), fff)
   ElseIf Mid(intervale(kkk), 1, 1) = "<" Then
      inclus = False
      Call subfunctie(Mid(intervale(kkk), 2, Len(intervale(kkk)) - 1), fff)
   Else
      max = True
   End If
   fff = (fff * 100 / scala) + 267
   fff = Fix(fff)
   If max = True Then
      fff = 530
   End If
   If fff > 530 Then
      fff = 530
   End If
   For i = ultim + plus To fff
       progr (i)
       X = (i - 267) * scala / 100
       nedef = False
       infinit = False
       fass = True
       Call subfunctie(texte(kkk), f)
       If texte(kkk) = "!" Then
          nedef = True
       End If
       If (nedef = True) Then
          nn = 2
          If opp(1) = True Then
          For j = 1 To 41
              Form2.Picture1.PSet (i, j * 10 + (i Mod 10)), RGB(155, 255, 0)
          Next
          End If
       End If
       If (nedef = False) And (infinit = False) Then
        f = f * 100 / scala
        If (f < 1) And (f > 0) Then
            f = 1
        End If
        If (f > -1) And (f < 0) Then
            f = -1
        End If
        Form2.Picture1.PSet (i, 212 - f), RGB(0, 255, 0)
         If (f - ff > 200) Or (ff - f > 200) Then
            okk = False
          Else
            okk = True
          End If
         If nn > 0 Then
           nn = nn - 1
          End If
         If ((incep = 1) And ((ff + 1 <> f) Or (ff - 1 <> f) Or (ff <> f)) And (okk = True) And (nn = 0)) Then
                Form2.Picture1.Line (i, 212 - f)-(i - 1, 212 - ff), RGB(0, 255, 0)
          End If
       ff = f
       incep = 1
       End If
       Picture1.DataChanged = False
   Next
   ultim = fff
   If intervale(kkk) = "" Then
      Exit For
   End If
Next
   Frame1.Visible = False
   DoEvents
   Image1.Visible = True
   Image2.Visible = False
End Sub

Private Sub Combo3_Change()
 If Combo5.Text <> "" Then 'And Combo3.Text <> "" Then
   texte(Val(Combo5.Text)) = Combo3.Text
 End If
End Sub

Private Sub Combo4_Change()
 If Combo5.Text <> "" And Combo4.Text <> "" Then
    intervale(Val(Combo5.Text)) = Combo4.Text
 End If
End Sub

Private Sub Combo5_Click()
 Dim kp As Integer
 Combo3.Clear
 Combo4.Clear
 kp = Val(Combo5.Text)
 If kp <> 0 Then
   Combo3.Text = texte(kp)
   Combo4.Text = intervale(kp)
 End If
 For kp = 1 To 9
   Combo3.AddItem texte(kp)
   Combo4.AddItem intervale(kp)
 Next
End Sub

Private Sub Command1_Click(Index As Integer)
  End
End Sub

Private Sub Command10_Click()
  Call grafica2
End Sub

Private Sub Command11_Click()
  Form2.Enabled = False
  Help3.Show
End Sub

Private Sub Command2_Click()
 t = Text1.Text
 If t <> "" Then
    Call grafic
 End If
End Sub

Private Sub Command3_Click()
Form2.Enabled = False
Help2.Show
End Sub

Private Sub Command4_Click()
Form2.Enabled = False
Help.Show
End Sub

Private Sub Command5_Click()
Form2.Enabled = False
Informations.Show
End Sub

Private Sub Command6_Click()
 t = Form2.Combo2.Text
 If t <> "" Then
    Call grafic
 End If
End Sub

Private Sub Command7_Click()
Form2.Enabled = False
Options.Show
End Sub

Private Sub Command8_Click()
   End
End Sub

Private Sub Command9_Click()
Form2.WindowState = 1
End Sub

Private Sub Form_Load()
startprog = True
Dim i
For i = 1 To 10
    Combo1.AddItem (i)
Next
Combo1.Text = 2
Text1.AddItem ("(e^x-e^(-x))/2 = sh(x)")
Text1.AddItem ("(e^x-e^(-x))/(e^x+e^(-x)) = th(x)")
Text1.AddItem ("(2,(x^2-x+4))/(x+1)")
Text1.AddItem ("radical(2,x^2+|x|)")
Text1.AddItem ("ln(x)/(x-1)")
Text1.AddItem ("ln(2+sin(x))")
Text1.AddItem ("e^(-(x^2))")
Text1.AddItem ("sin(x)+1/2*sin(2*x)")
Text1.AddItem ("ln(1+sin(x)+|sin(x)|)")
Text1.AddItem ("x+radical(2,x^2+x)")
Text1.AddItem ("((x-1)^3)/(x^2+x+1)")
Text1.AddItem ("x^3-3*x")
Text1.AddItem ("(x^3)/(x^2-1)")
Text1.AddItem ("x/(4-x^2)")
Text1.AddItem ("2*x/(x^3+1)")
Text1.AddItem ("((-4)*x)/(x^2+3*x+1/4)")
Text1.AddItem ("(x^2-4*x+2)/(x^2-3*x+2)")
Text1.AddItem ("ln((x+1)*(x+3)/(x*(x+4)))")
Text1.AddItem ("1/(x+1)*e^(1/x)")
Text1.AddItem ("ln(1-1/(x^2))")
Text1.AddItem ("x/(radical(3,(x^2-1))")
Text1.AddItem ("radical(2,(x^3-3*x))")
Text1.AddItem ("radical(2,8+x)-radical(2,8-x)")
Text1.AddItem ("x+sin(x)")
Text1.AddItem ("cos(2*x)+sin(x)")
Text1.AddItem ("radical(3,x^3+3*x^2-4)")
Text1.AddItem ("radical(2,|x^2-1|)-x")
Text1.AddItem ("(|x|-3)/(1+|x|)")
Text1.AddItem ("x/|x-2|+(x-2)/|x|")
Text1.AddItem ("(2*x^2+1)/(x*(x+2))")
Text1.AddItem ("x*sin(1/x)")
Text1.AddItem ("radical(2,(x^2-1))/(x+2))")
Text1.AddItem ("sin(x)^3+cos(x)^3")
Text1.AddItem ("e^(1/(x^2-3*x))")
Text1.AddItem ("")
Text1.AddItem ("")
Text1.AddItem ("------------------------------------------------------------------------------")
Text1.AddItem ("")
opp(1) = True
  For i = 2 To 3
     opp(i) = False
  Next
Combo5.Text = "1"
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Form2.Label8 = (X - 267) * scala / 100
 Form2.Label9 = (212 - Y) * scala / 100
 Picture1.ToolTipText = Label8 + " , " + Label9
 DoEvents
End Sub

⌨️ 快捷键说明

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