form6.frm

来自「某大学开发的一个用于对微波传输线状态进行模拟的软件」· FRM 代码 · 共 1,338 行 · 第 1/4 页

FRM
1,338
字号
      Begin VB.PictureBox Picture2 
         Height          =   4100
         Left            =   90
         ScaleHeight     =   4035
         ScaleWidth      =   3135
         TabIndex        =   5
         Top             =   270
         Visible         =   0   'False
         Width           =   3200
         Begin VB.Image Image1 
            Height          =   4100
            Left            =   0
            Stretch         =   -1  'True
            Top             =   0
            Width           =   3200
         End
      End
      Begin VB.PictureBox Picture1 
         Height          =   4100
         Left            =   90
         ScaleHeight     =   4035
         ScaleWidth      =   3135
         TabIndex        =   4
         Top             =   270
         Visible         =   0   'False
         Width           =   3200
         Begin VB.Image Image2 
            Height          =   4100
            Left            =   0
            Stretch         =   -1  'True
            Top             =   0
            Width           =   3200
         End
      End
   End
   Begin ResizeLibCtl.ReSize ReSize1 
      Left            =   270
      Top             =   5250
      _Version        =   131072
      _ExtentX        =   741
      _ExtentY        =   741
      _StockProps     =   0
      Enabled         =   -1  'True
      FormMinWidth    =   0
      FormMinHeight   =   0
      FormDesignHeight=   5880
      FormDesignWidth =   7515
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   350
      Left            =   6180
      TabIndex        =   2
      Top             =   5280
      Width           =   1000
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   350
      Left            =   4800
      TabIndex        =   1
      Top             =   5280
      Width           =   1000
   End
   Begin ComctlLib.TabStrip TabStrip1 
      Height          =   5000
      Left            =   100
      TabIndex        =   0
      Top             =   100
      Width           =   7300
      _ExtentX        =   12859
      _ExtentY        =   8811
      _Version        =   327682
      BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
         NumTabs         =   2
         BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "带状线"
            Object.Tag             =   ""
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "耦合带状线"
            Object.Tag             =   ""
            ImageVarType    =   2
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
Dim pi As Double
pi = 4 * Atn(1)
If Frame2.Visible = True Then
Text5.Text = "?"
Dim w, b, t, er, ZO, m, m1, n, X As Double
w = Text1.Text
b = Text2.Text
t = Text3.Text
er = Text4.Text
 If w <= 0 Or b = 0 Or t >= b Or er <= 0 Then
    MsgBox "输入参数无效!请重新输入!"
 Else
X = t / b
n = 2 / (1 + (2 * X) / (3 * (1 - X)))
If X = 0 Then
m1 = 0
Else
m1 = (X / (pi * (1 - X))) * (1 - 0.5 * Log((X / (2 - X)) ^ 2 + ((0.0796 * X) / (w / b + 1.1 * X)) ^ n))
End If
m = w / (b - t) + m1
ZO = (30 / Sqr(er)) * Log(1 + (4 / (pi * m)) * ((8 / (pi * m)) + Sqr((8 / (pi * m)) ^ 2 + 6.27)))
Text5.Text = Format(ZO, "##########.0000000000")
End If
End If

If Frame4.Visible = True Then
Text9.Text = "?"
Dim zo2, er2, tb, wb, l1, l2, n1, a, k As Double
zo2 = Text6.Text
er2 = Text7.Text
tb = Text8.Text
 If zo2 <= 0 Or tb < 0 Or er2 <= 0 Then
    MsgBox "输入参数无效!请重新输入!"
 Else
 a = (zo2 * Sqr(er2)) / 30 't>=b erroe
 n1 = 2 / (1 + 2 * tb / (3 * (1 - tb)))
 l1 = (8 * (1 - tb) * Sqr(Exp(a) + 0.568)) / (pi * (Exp(a) - 1))
 If tb = 0 Then
 If a < pi Then
 k = ((Exp(pi ^ 2 / a) - 2) / (Exp(pi ^ 2 / a) + 2)) ^ 2
 Else
 k = Sqr(1 - ((Exp(a) - 2) / (Exp(a) + 2)) ^ 4)
 End If
 If k = 1 Then
 wb = 0
 Else
 wb = (1 / pi) * Log((1 + k) / (1 - k))
 End If
 Text9.Text = Format(wb, "##########.0000000000")
Else
l2 = (tb / pi) * (1 - 0.5 * Log((tb / (2 - tb)) ^ 2 + ((0.0796 * tb) / (l1 - 0.26 * tb)) ^ n1))
wb = l1 - l2
Text9.Text = Format(wb, "##########.0000000000")
End If
End If
End If

If Frame3.Visible = True Then
   Text15.Text = "?"
   Text16.Text = "?"
Dim w1, b1, s, t1, er1, ao, ae, ct, cf, zoe, zoo, zo1, th As Double
w1 = Text10.Text
b1 = Text11.Text
s = Text12.Text
t1 = Text13.Text
er1 = Text14.Text
 If w1 <= 0 Or b1 <= 0 Or er1 <= 0 Or s <= 0 Or t1 < 0 Or b1 = t1 Then
    MsgBox "输入参数无效!请重新输入!"
 Else
ct = (pi * s) / (2 * b1)
If t1 = 0 Then
cf = 2 * Log(2)
Else
cf = 2 * Log((2 * b1 - t1) / (b1 - t1)) - (t1 / b1) * Log(t1 * (2 * b1 - t1) / (b1 - t1) ^ 2)
End If
th = (Exp(ct) - 1 / Exp(ct)) / (Exp(ct) + 1 / Exp(ct))
ae = 1 + Log(1 + th) / Log(2)
ao = 1 + Log(1 + 1 / th) / Log(2)
zoe = (30 * pi * (b1 - t1)) / (Sqr(er1) * (w1 + b1 * cf * ae / (2 * pi)))
zoo = (30 * pi * (b1 - t1)) / (Sqr(er1) * (w1 + b1 * cf * ao / (2 * pi)))
zo1 = Sqr(zoo * zoe)
Text15.Text = Format(zoe, "##########.0000000000")
Text16.Text = Format(zoo, "##########.0000000000")
End If
End If

If Frame5.Visible = True Then
 Text23.Text = "?"
 Text24.Text = "?"
 Dim zoe1, zoo1, er3, wb1, sb1, zo3, ao1, ae1, ke, ko, th1, th2 As Double
zoe1 = Text18.Text
zoo1 = Text19.Text
er3 = Text20.Text
 If zoe1 <= 0 Or zoo1 <= 0 Or er3 <= 0 Then
    MsgBox "输入参数无效!请重新输入!"
 Else
ae1 = zoe1 * Sqr(er3) / 30
ao1 = zoo1 * Sqr(er3) / 30
If ae1 > 0 And ae1 < pi Then
ke = ((Exp(pi ^ 2 / ae1) - 2) / (Exp(pi ^ 2 / ae1) + 2)) ^ 2
ElseIf ae1 >= pi Then
ke = Sqr(1 - ((Exp(ae1) - 2) / (Exp(ae1) + 2)) ^ 4)
End If
If ao1 > 0 And ao1 < pi Then
ko = ((Exp(pi ^ 2 / ao1) - 2) / (Exp(pi ^ 2 / ao1) + 2)) ^ 2
ElseIf ao1 >= pi Then
ko = Sqr(1 - ((Exp(ao1) - 2) / (Exp(ao1) + 2)) ^ 4)
End If
If Sqr(ke * ko) >= 1 Then
 MsgBox "输入参数无效!请重新输入!"
 Else
th1 = 0.5 * Log((1 + Sqr(ke * ko)) / (1 - Sqr(ke * ko)))
th2 = 0.5 * Log((1 + ((1 - ko) / (1 - ke)) * Sqr(ke / ko)) / (1 - ((1 - ko) / (1 - ke)) * Sqr(ke / ko)))
wb1 = 2 * th1 / pi
sb1 = 2 * th2 / pi
zo3 = Sqr(zoe1 * zoo1)
Text23.Text = Format(wb1, "##########.0000000000")
Text24.Text = Format(sb1, "##########.0000000000")
End If
End If
End If

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Dim i As Integer
    '处理 ctrl+tab 键,移动到下一个选项卡
    If Shift = vbCtrlMask And KeyCode = vbKeyTab Then
        i = TabStrip1.SelectedItem.Index
        If i = TabStrip1.Tabs.Count Then
            '最后一个选项卡,返回到选项卡 1
            Set TabStrip1.SelectedItem = TabStrip1.Tabs(1)
        Else
            ' 选项卡序数加 1
            Set TabStrip1.SelectedItem = TabStrip1.Tabs(i + 1)
        End If
    End If
End Sub

Private Sub Form_Load()
    '窗体居中
     Me.Left = 1200
   Me.Top = 1200
   Me.Width = 8000
   Me.Height = 6000
   Image1.Picture = LoadPicture(App.Path & "\image\dzx.bmp")
    Image2.Picture = LoadPicture(App.Path & "\image\ohdzx.bmp")
End Sub

Private Sub Option1_Click()
Frame2.Visible = True
Frame4.Visible = False
Option3.Value = True
End Sub

Private Sub Option2_Click()
Frame2.Visible = False
Frame4.Visible = True
Option4.Value = True
End Sub

Private Sub Option3_Click()
Frame2.Visible = True
Frame4.Visible = False
Option1.Value = True
End Sub

Private Sub Option4_Click()
Frame2.Visible = False
Frame4.Visible = True
Option2.Value = True
End Sub

Private Sub Option5_Click()
Frame3.Visible = True
Frame5.Visible = False
Option7.Value = True
End Sub

Private Sub Option6_Click()
Frame3.Visible = False
Frame5.Visible = True
Option8.Value = True
End Sub

Private Sub Option7_Click()
Frame3.Visible = True
Frame5.Visible = False
Option5.Value = True
End Sub

Private Sub Option8_Click()
Frame3.Visible = False
Frame5.Visible = True
Option6.Value = True
End Sub

 Private Sub TabStrip1_Click()
    
     Dim i As Integer
     '显示并激活选中的选项卡控件
     '隐藏并禁止所有其它控件
      For i = 1 To TabStrip1.Tabs.Count
        If i = TabStrip1.SelectedItem.Index Then
           Frame2.Visible = False
           Frame3.Visible = True
           Frame4.Visible = False
           Frame5.Visible = False
           Me.Picture1.Visible = True
           Me.Picture2.Visible = False
           Option5.Value = True
         Else
           Frame2.Visible = True
           Frame3.Visible = False
           Frame4.Visible = False
           Frame5.Visible = False
            Me.Picture2.Visible = True
            Me.Picture1.Visible = False
            Option1.Value = True
        End If
    Next
    
End Sub

⌨️ 快捷键说明

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