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

📄 form4.frm

📁 一款电场线的教学软件可以自定义电荷多少
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form4 
   BackColor       =   &H8000000B&
   Caption         =   "高级应用"
   ClientHeight    =   7290
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9825
   LinkTopic       =   "Form4"
   ScaleHeight     =   7290
   ScaleWidth      =   9825
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame2 
      Caption         =   "提示"
      Height          =   615
      Left            =   840
      TabIndex        =   5
      Top             =   6360
      Width           =   4815
      Begin VB.Label Label1 
         Height          =   255
         Left            =   120
         TabIndex        =   6
         Top             =   240
         Width           =   4575
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "绘图区"
      Height          =   4815
      Left            =   1200
      TabIndex        =   3
      Top             =   1080
      Width           =   7455
      Begin VB.PictureBox Picture1 
         Height          =   4455
         Left            =   360
         ScaleHeight     =   4395
         ScaleWidth      =   6675
         TabIndex        =   4
         Top             =   240
         Width           =   6735
      End
   End
   Begin VB.CommandButton Command2 
      Caption         =   "显示"
      Height          =   375
      Left            =   6000
      TabIndex        =   2
      Top             =   6600
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "返回"
      Height          =   375
      Left            =   7560
      TabIndex        =   1
      Top             =   6600
      Width           =   1455
   End
   Begin MSComctlLib.TabStrip TabStrip1 
      Height          =   5535
      Left            =   840
      TabIndex        =   0
      Top             =   600
      Width           =   8175
      _ExtentX        =   14420
      _ExtentY        =   9763
      MultiRow        =   -1  'True
      TabFixedWidth   =   1764
      TabFixedHeight  =   1764
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   4
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "直线"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "三角形"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "静电透镜1"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "静电透镜2"
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Me.Hide
    form1.Show
End Sub

Private Sub Command2_Click()
    Picture1.Cls
    Select Case TabStrip1.SelectedItem.Index
        Case 1
            Label1.Caption = "直导体周围的电场线分布情况"
            Call LConductor
        Case 2
            Label1.Caption = "三角形导体周围的电场线分布情况"
            Call Tangular
        Case 3
            Label1.Caption = "静电透镜1的演示(左边导体有限)"
            Call jdtj1
        Case 4
            Label1.Caption = "静电透镜2的演示(左边导体无限)"
            Call jdtj2

    End Select

End Sub

Private Sub Form_Load()
    Label1.Caption = "这里是静电力的一些高级应用>>"
End Sub

Private Function DX(ByVal x1 As Integer, ByVal y1 As Integer, ByVal x2 As Integer, ByVal y2 As Integer, ByVal x As Integer, ByVal y As Integer, ByVal q As Integer) As Double
    Dim k, qx, qy, ddxx As Double
    Dim R As Double
    If x1 <> x2 Then
        k = (y2 - y1) / (x2 - x1)
        qx = x1
        qy = k * (qx - x1) + y1
        ddxx = 0
        If k > 0 Then
             Do While qx - x2 <> -50
                R = Sqr((qx - x) ^ 2 + (qy - y) ^ 2)
                ddxx = ddxx + q * (x - qx) / R ^ 3
                If x2 > x1 Then
                    qx = qx + 50
                Else: qx = qx - 50
                End If
                qy = k * (qx - x1) + y1
           Loop
        Else
             Do While qx - x2 <> 50
                R = Sqr((qx - x) ^ 2 + (qy - y) ^ 2)
                ddxx = ddxx + q * (x - qx) / R ^ 3
                If x2 > x1 Then
                    qx = qx + 50
                Else: qx = qx - 50
                End If
                qy = k * (qx - x1) + y1
           Loop
        End If
    Else
        qx = x1
        qy = y1
        ddxx = 0
        Do While qy - y2 <> 50
            R = Sqr((qx - x) ^ 2 + (qy - y) ^ 2)
            ddxx = ddxx + q * (x - qx) / R ^ 3
            qy = qy + 50
        Loop
    End If
    DX = ddxx
End Function

Private Function DY(ByVal x1 As Integer, ByVal y1 As Integer, ByVal x2 As Integer, ByVal y2 As Integer, ByVal x As Integer, ByVal y As Integer, ByVal q As Integer) As Double
    Dim k, qx, qy, ddyy As Double
    Dim R As Double
    If x1 <> x2 Then
        k = (y2 - y1) / (x2 - x1)
        qx = x1
        qy = y1
        ddyy = 0
        If k >= 0 Then
             Do While qx - x2 <> -50
                R = Sqr((qx - x) ^ 2 + (qy - y) ^ 2)
                ddyy = ddyy + q * (y - qy) / R ^ 3
                If x2 > x1 Then
                    qx = qx + 50
                Else: qx = qx - 50
                End If
                qy = k * (qx - x1) + y1
           Loop
        Else
             Do While qx - x2 <> 50
                R = Sqr((qx - x) ^ 2 + (qy - y) ^ 2)
                ddyy = ddyy + q * (y - qy) / R ^ 3
                If x2 > x1 Then
                    qx = qx + 50
                Else: qx = qx - 50
                End If
                qy = k * (qx - x1) + y1
           Loop
        End If
    Else
        qx = x1
        qy = y1
        ddyy = 0
        Do While qy - y2 <> 50
            R = Sqr((qx - x) ^ 2 + (qy - y) ^ 2)
            ddyy = ddyy + q * (y - qy) / R ^ 3
            qy = qy + 50
        Loop
    End If
    DY = ddyy
End Function

Private Sub LConductor()
    Picture1.DrawWidth = 2
    Label1.Caption = "直导体周围的电场线分布情况"
    Picture1.Line (Picture1.ScaleWidth / 2 - 1500, Picture1.ScaleHeight / 2 - 100)-(Picture1.ScaleWidth / 2 + 1500, Picture1.ScaleHeight / 2 + 100), QBColor(2), BF
    Dim dxx, dyy, qx, qy, ddxx, ddyy As Double
    Dim m, ds As Integer
    ds = 50
    
    x = Picture1.ScaleWidth / 2 - 1650
    y = Picture1.ScaleHeight / 2 - 100
    Do While x - Picture1.ScaleWidth / 2 - 1500 <> 150
        qx = x

⌨️ 快捷键说明

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