ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 03.02.2024
Просмотров: 30
Скачиваний: 1
ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.
Приложение 2
Приложение 3
Private Sub Command1_Click()
If Text1.Text = "" Then Text1.Text = "200"
If Text2.Text = "" Then Text2.Text = "10"
If Text3.Text = "" Then Text3.Text = "4"
q1 = Val(Text2.Text)
Q2 = Val(Text3.Text)
l = Val(Text1.Text)
A1 = HScroll1.Value / 10
Y1 = HScroll2.Value / 10
90 Picture1.Circle (420, 130), 5, QBColor(4)
100 Picture1.Circle (420 - l, 130), 5, QBColor(4)
110 a = 0
120 a = a + A1
130 GoTo 150
140 a = a + A1 * Abs(q1 / Q2)
150 If a > 4 * 3.141592654 Then
For I = 1 To 5
Picture1.Circle (420, 130), I, QBColor(4)
Picture1.Circle (420 - l, 130), I, QBColor(4)
Next I
Exit Sub
End If
160 If a > 3 * 3.141592654 Then GoTo 280
170 If a > 2 * 3.141592654 Then GoTo 250
180 If a > 1 * 3.141592654 Then GoTo 220
190 Y2 = Y1
200 x = l / 2 + Y2 / Tan(a)
210 GoTo 310
220 Y2 = -Y1
230 x = l / 2 + Y2 / Tan(a)
240 GoTo 310
250 Y2 = Y1
260 x = -l / 2 + Y2 / Tan(a)
270 GoTo 310
280 Y2 = -Y1
290 x = -l / 2 + Y2 / Tan(a)
300 GoTo 310
310 For y = Y2 To 360 / Y2 Step Y2
320 X3 = x - l / 2
330 X4 = x + l / 2
340 R1 = Sqr(X3 * X3 + y * y)
350 R2 = Sqr(X4 * X4 + y * y)
360 R5 = R1 * R1 * R1
370 R6 = R2 * R2 * R2
380 FX = q1 * X3 / R5 + Q2 * X4 / R6
390 FY = (q1 / R5 + Q2 / R6) * y
400 If FY = 0 Then GoTo 120
410 X1 = Y2 * FX / FY
420 x = x + X1
430 Picture1.PSet (x + 420 - l / 2, y * 0.64 + 130), QBColor(12)
440 Next y
450 If a > 2 * 3.141592654 Then GoTo 140
460 GoTo 120
End Sub
Private Sub Command2_Click()
Picture1.Cls
End Sub
Private Sub Command3_Click()
x = MsgBox("Завершить исследование?", vbExclamation + vbYesNo, "Электрическое поле")
If x = vbYes Then End
End Sub
Private Sub Form_Load()
HScroll1.Value = 2
HScroll2.Value = 10
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cancel = 1
End Sub
Private Sub Text1_LostFocus()
If Val(Text1.Text) < 5 Or Val(Text1.Text) > 200 Then Text1.Text = "200"
End Sub
Private Sub Text4_LostFocus()
If Val(Text4.Text) < 0.01 Or Val(Text4.Text) > 1 Then Text4.Text = "0.5"
End Sub
Private Sub Text5_LostFocus()
If Val(Text5.Text) < 0.1 Then Text5.Text = "2"
If Val(Text5.Text) > 5 Then Text5.Text = "2"
End Sub