?? 駐波的形成.frm
字號:
ForeColor = &H00FFFF80&
Height = 255
Left = 240
TabIndex = 10
Top = 720
Width = 1335
End
Begin VB.Label Label1
Caption = "向左行進的波"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFF80&
Height = 375
Left = 240
TabIndex = 9
Top = 480
Width = 1455
End
End
Begin VB.Timer Timer1
Interval = 10
Left = 1920
Top = 4680
End
Begin VB.Menu showMnu
Caption = "showMnu"
Visible = 0 'False
Begin VB.Menu readMe
Caption = "課件說明…"
End
Begin VB.Menu about
Caption = "關于本課件…"
End
Begin VB.Menu k1
Caption = "-"
End
Begin VB.Menu toLeft
Caption = "顯示向左的行波"
Checked = -1 'True
End
Begin VB.Menu toRight
Caption = "顯示向右的行波"
Checked = -1 'True
End
Begin VB.Menu both
Caption = "顯示合成波"
Checked = -1 'True
End
Begin VB.Menu k2
Caption = "-"
End
Begin VB.Menu step
Caption = "單步"
End
Begin VB.Menu pause
Caption = "暫停"
End
Begin VB.Menu change
Caption = "顯示修改參數對話框"
Checked = -1 'True
End
Begin VB.Menu k3
Caption = "-"
End
Begin VB.Menu exitThis
Caption = "退出程序"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const pi As Single = 3.1415926
Public x0 As Integer, y0 As Integer '初始坐標原點
Public xx As Integer, yy As Integer '保存鼠標坐標
Public le As Boolean, ri As Boolean, su As Boolean '鼠標擊鍵標志
Public leftA As Integer, leftT As Integer, leftJ As Integer, leftL As Integer '左行波的振幅、周期、初相角、波長
Public rightA As Integer, rightT As Integer, rightJ As Integer, rightL As Integer '右行波的振幅、周期、初相角、波長
Public timeCount As Long '時間計數器
Public boll1X As Integer, boll2X As Integer, boll As Integer
Public boll1 As Boolean, boll2 As Boolean
Sub draw()
Dim i As Integer, s As Single
Dim y11 As Single, y12 As Single
Dim y21 As Single, y22 As Single
Dim y31 As Single, y32 As Single
leftA = HScroll11.Value
leftT = HScroll12.Value
leftJ = HScroll13.Value * pi / 180
leftL = HScroll14.Value
rightA = HScroll21.Value
rightT = HScroll22.Value
rightJ = HScroll23.Value * pi / 180
rightL = HScroll24.Value
s = 3 '步長,此參數影響曲線的光滑程度
timeCount = timeCount + 1
For i = 0 To x0 Step s
y12 = leftA * Sin(2 * pi * (timeCount / leftT + i / leftL) + leftJ)
y22 = rightA * Sin(2 * pi * (timeCount / rightT - i / rightL) + rightJ)
y32 = y12 + y22
If toLeft.Checked And i > 0 Then
DrawWidth = 2
Form1.Line (i, y11)-(i + s, y12), RGB(255, 0, 0)
End If
y11 = y12
If toRight.Checked And i > 0 Then
DrawWidth = 2
Form1.Line (i, y21)-(i + s, y22), RGB(0, 255, 0)
End If
y21 = y22
If both.Checked And i > 0 Then
DrawWidth = 3
Form1.Line (i, y31)-(i + s, y32), RGB(0, 0, 255)
If boll1 And i <= boll1X And i + s >= boll1X Then
Picture1.Move boll1X - Picture1.Width / 2, (y31 + y32) / 2 + Picture1.Height / 2
End If
If boll2 And i <= boll2X And i + s >= boll2X Then
Picture2.Move boll2X - Picture2.Width / 2, (y31 + y32) / 2 + Picture2.Height / 2
End If
End If
y31 = y32
Next i
End Sub
Private Sub about_Click()
Dim say As String
say = say + "“駐波的形成”課件" + Chr(13) + Chr(13)
say = say + "制作:畢廣吉" + Chr(13)
say = say + "天津師范大學物理與電子信息學院" + Chr(13)
say = say + "2001年7月" + Chr(13)
say = MsgBox(say, vbOKOnly, "關于“駐波的形成”課件")
End Sub
Private Sub change_Click()
change.Checked = Not change.Checked
Frame1.Visible = change.Checked
End Sub
Private Sub exitThis_Click()
End
End Sub
Private Sub Form_Activate()
DrawWidth = 1
Form1.Line (0, 0)-(x0, 0), vbWhite
'Form1.Line (0, -y0)-(0, y0), vbWhite
End Sub
Private Sub Form_Click()
If step.Checked Then
Form1.Cls
Call Form_Activate
Call draw
End If
End Sub
Private Sub Form_DblClick()
If Not step.Checked Then
If boll = 0 Then
boll1X = xx - Picture1.Width / 2
boll1 = Not boll1
Picture1.Visible = boll1
End If
If boll = 1 Then
boll2X = xx - Picture2.Width / 2
boll2 = Not boll2
Picture2.Visible = boll2
End If
boll = 1 - boll
End If
End Sub
Private Sub Form_Load()
Timer1.Interval = 50 '此參數影響刷新曲線的時間間隔,單位:毫秒
Form1.Left = 0
Form1.Top = 0
Form1.Width = Screen.Width
Form1.Height = Screen.Height
x0 = 800 'Form1.Width
y0 = 600 'Form1.Height / 2
Form1.Scale (0, y0)-(x0, -y0)
HScroll11.Value = y0 / 2
HScroll12.Value = 150
HScroll13.Value = 0
HScroll14.Value = x0 / 2
HScroll21.Value = y0 / 2
HScroll22.Value = 150
HScroll23.Value = 0
HScroll24.Value = x0 / 2
Label11.Caption = HScroll11.Value
Label12.Caption = HScroll12.Value
Label13.Caption = HScroll13.Value
Label14.Caption = HScroll14.Value
Label21.Caption = HScroll21.Value
Label22.Caption = HScroll22.Value
Label23.Caption = HScroll23.Value
Label24.Caption = HScroll24.Value
HScroll11.Min = y0 / 5 '振幅
HScroll21.Min = y0 / 5
HScroll11.Max = y0 * 0.8
HScroll21.Max = y0 * 0.8
HScroll12.Min = 5 '周期(毫秒)
HScroll22.Min = 5
HScroll12.Max = 100
HScroll22.Max = 100
HScroll13.Min = 0 '初位相
HScroll23.Min = 0
HScroll13.Max = 360
HScroll23.Max = 360
HScroll14.Min = x0 / 4 '波長
HScroll24.Min = x0 / 4
HScroll14.Max = x0 * 2
HScroll24.Max = x0 * 2
boll1X = 0
boll2X = 0
boll1 = False
boll2 = False
boll = 0
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
xx = X
yy = Y
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
Form1.PopupMenu showMnu
End If
End Sub
Private Sub Frame1_Click()
change.Checked = Not change.Checked
Frame1.Visible = change.Checked
End Sub
Private Sub HScroll11_Change()
Label11.Caption = HScroll11.Value
End Sub
Private Sub HScroll11_Scroll()
Label11.Caption = HScroll11.Value
End Sub
Private Sub HScroll12_Change()
Label12.Caption = HScroll12.Value
End Sub
Private Sub HScroll12_Scroll()
Label12.Caption = HScroll12.Value
End Sub
Private Sub HScroll13_Change()
Label13.Caption = HScroll13.Value
End Sub
Private Sub HScroll13_Scroll()
Label13.Caption = HScroll13.Value
End Sub
Private Sub HScroll14_Change()
Label14.Caption = HScroll14.Value
End Sub
Private Sub HScroll14_Scroll()
Label14.Caption = HScroll14.Value
End Sub
Private Sub HScroll21_Change()
Label21.Caption = HScroll21.Value
End Sub
Private Sub HScroll22_Change()
Label22.Caption = HScroll22.Value
End Sub
Private Sub HScroll22_Scroll()
Label22.Caption = HScroll22.Value
End Sub
Private Sub HScroll23_Change()
Label23.Caption = HScroll23.Value
End Sub
Private Sub HScroll23_Scroll()
Label23.Caption = HScroll23.Value
End Sub
Private Sub HScroll24_Change()
Label24.Caption = HScroll24.Value
End Sub
Private Sub HScroll24_Scroll()
Label24.Caption = HScroll24.Value
End Sub
Private Sub pause_Click()
pause.Checked = Not pause.Checked
Timer1.Enabled = Not Timer1.Enabled
step.Enabled = Not pause.Checked
End Sub
Private Sub readMe_Click()
Dim say As String
say = say + "1.從快捷菜單中選擇欲顯示的曲線。" + Chr(13)
say = say + "2.雙擊窗體加入或除去質點:" + Chr(13)
say = say + " 第一次雙擊加入第一個質點," + Chr(13)
say = say + " 第二次雙擊加入第二個質點," + Chr(13)
say = say + " 第三次雙擊除去第一個質點," + Chr(13)
say = say + " 第四次雙擊除去第二個質點," + Chr(13)
say = say + " 其余類推。" + Chr(13)
say = say + "3.選擇“單步”以后,每一次單擊前進一步。" + Chr(13)
say = say + "4.選擇“暫停”后若要繼續,應再一次" + Chr(13)
say = say + " 選擇“暫停”去掉對鉤。" + Chr(13)
say = say + "5.通過選擇“顯示修改參數對話框”" + Chr(13)
say = say + " 可以修改系統參數。" + Chr(13)
say = MsgBox(say, vbOKOnly, "“駐波的形成”課件使用說明:")
End Sub
Private Sub step_Click()
step.Checked = Not step.Checked
Timer1.Enabled = Not Timer1.Enabled
pause.Enabled = Not step.Checked
End Sub
Private Sub Timer1_Timer()
Form1.Cls
Call Form_Activate
Call draw
End Sub
Private Sub toLeft_Click()
toLeft.Checked = Not toLeft.Checked
le = toLeft.Checked
End Sub
Private Sub toRight_Click()
toRight.Checked = Not toRight.Checked
ri = toRight.Checked
End Sub
Private Sub both_Click()
both.Checked = Not both.Checked
su = both.Checked
Picture1.Visible = su
Picture2.Visible = su
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -