Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.     Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
  4.  
  5.         PictureBox1.Height = 240 - (5 * TrackBar1.Value)
  6.  
  7.     End Sub
  8.  
  9.  
  10.     Sub Delay(ByVal dblSecs As Double)
  11.  
  12.         Const OneSec As Double = 1.0# / (1440.0# * 60.0#)
  13.         Dim dblWaitTil As Date
  14.         Now.AddSeconds(OneSec)
  15.         dblWaitTil = Now.AddSeconds(OneSec).AddSeconds(dblSecs)
  16.         Do Until Now > dblWaitTil
  17.             Application.DoEvents() ' Allow windows messages to be processed
  18.        Loop
  19.  
  20.     End Sub
  21.  
  22.  
  23.     Private Sub TrackBar1_MouseCaptureChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.MouseCaptureChanged
  24.         Dim A, fi, k, w, mass As Double
  25.         fi = 1.2
  26.         k = 0.5
  27.         mass = 0.05 ' 50 gramov
  28.        w = Math.Pow(k / mass, -2)
  29.         A = 5 * TrackBar1.Value
  30.  
  31.         Dim time As Integer
  32.         time = 0
  33.  
  34.         While time < 100000
  35.             PictureBox1.Height = 240 + A * Math.Cos(w * time + fi)
  36.             TextBox1.Text = PictureBox1.Height
  37.             time = time + 5
  38.             Call Delay(0.01)
  39.         End While
  40.  
  41.         TrackBar1.Value = 0
  42.         PictureBox1.Height = 220
  43.     End Sub
  44.  
  45.     Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
  46.  
  47.     End Sub
  48. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement