Эквипотенциальные поверхности электростатического поля

 

Dim Q1, Q2, Q3, Q4, RR, GG, BB, Fi, PP As Double

 

Private Sub Command1_Click()

Picture2.Visible = False

End Sub

 

Private Sub Command2_Click()

Picture2.Visible = True

End Sub

 

Private Sub Command3_Click()

Picture1.BackColor = RGB(250, 250, 250)

End Sub

 

Private Sub Form_Activate()

Label10.BackColor = RGB(255, 0, 0)

Label11.BackColor = RGB(0, 255, 0)

Label12.BackColor = RGB(0, 0, 255)

Label13.BackColor = RGB(255, 255, 0)

Label14.BackColor = RGB(255, 0, 255)

Label15.BackColor = RGB(0, 255, 255)

Label16.BackColor = RGB(0, 0, 0)

Label17.BackColor = RGB(150, 150, 150)

Label18.BackColor = RGB(255, 150, 150)

End Sub

 

 

Private Sub HScroll1_Change()

PP = HScroll1.Value / 10

Text5.Text = PP

End Sub

 

Private Sub Label10_Click()

RR = 255

GG = 0

BB = 0

End Sub

 

Private Sub Label11_Click()

RR = 0

GG = 255

BB = 0

End Sub

 

Private Sub Label12_Click()

RR = 0

GG = 0

BB = 255

End Sub

 

Private Sub Label13_Click()

RR = 255

GG = 255

BB = 0

End Sub

 

Private Sub Label14_Click()

RR = 255

GG = 0

BB = 255

End Sub

 

Private Sub Label15_Click()

RR = 0

GG = 255

BB = 255

End Sub

 

Private Sub Label16_Click()

RR = 0

GG = 0

BB = 0

End Sub

 

Private Sub Label17_Click()

RR = 150

GG = 150

BB = 150

End Sub

 

Private Sub Label18_Click()

RR = 255

GG = 150

BB = 150

End Sub

 

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Picture2.Visible = True Then

If Option1.Value = True Then

Shape1.Left = X

Shape1.Top = Y

Label1.Left = X + 400

Label1.Top = Y

Label1.Caption = Text1.Text

Q1 = Label1.Caption

End If

If Option2.Value = True Then

Shape2.Left = X

Shape2.Top = Y

Label2.Left = X + 400

Label2.Top = Y

Label2.Caption = Text2.Text

Q2 = Label2.Caption

End If

If Option3.Value = True Then

Shape3.Left = X

Shape3.Top = Y

Label3.Left = X + 400

Label3.Top = Y

Label3.Caption = Text3.Text

Q3 = Label3.Caption

End If

If Option4.Value = True Then

Shape4.Left = X

Shape4.Top = Y

Label4.Left = X + 400

Label4.Top = Y

Label4.Caption = Text4.Text

Q4 = Label4.Caption

End If

Else: If Button = 1 Then Picture1.Circle (X, Y), 20, RGB(RR, GG, BB)

End If

End Sub

 

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Picture2.Visible = False Then

If Button = 2 Then

Label19.Left = X

Label19.Top = Y

End If

r1 = Sqr((Shape1.Left - X) ^ 2 + (Shape1.Top - Y) ^ 2)

r2 = Sqr((Shape2.Left - X) ^ 2 + (Shape2.Top - Y) ^ 2)

r3 = Sqr((Shape3.Left - X) ^ 2 + (Shape3.Top - Y) ^ 2)

r4 = Sqr((Shape4.Left - X) ^ 2 + (Shape4.Top - Y) ^ 2)

Fi = Q1 / r1 + Q2 / r2 + Q3 / r3 + Q4 / r4

Fi = 10 * Fi

If Abs(Fi - PP) < 0.000001 Then

Label7.BackColor = RGB(200, 0, 0)

Else: Label7.BackColor = RGB(230, 230, 220)

End If

al = 1000 * (Fi - PP)

Line1.Y2 = Line1.Y1 - 1500 * Cos(al)

Line1.X2 = Line1.X1 + 1500 * Sin(al)

Label5.Caption = Fi

End If

End Sub