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

📄 例2-8.frm

📁 Visual Basic程序设计基础》-杨小影-源代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2235
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3825
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.5
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   2235
   ScaleWidth      =   3825
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton CmdCalcu 
      Caption         =   "计算"
      Height          =   495
      Left            =   1080
      TabIndex        =   8
      Top             =   1560
      Width           =   1455
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   3000
      TabIndex        =   5
      Top             =   120
      Width           =   375
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1920
      TabIndex        =   4
      Top             =   120
      Width           =   375
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   600
      TabIndex        =   3
      Top             =   120
      Width           =   375
   End
   Begin VB.Label Label2 
      Caption         =   "X2="
      Height          =   495
      Left            =   1920
      TabIndex        =   7
      Top             =   720
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "X1="
      Height          =   495
      Left            =   360
      TabIndex        =   6
      Top             =   720
      Width           =   975
   End
   Begin VB.Label Label5 
      Caption         =   "C="
      Height          =   375
      Left            =   2520
      TabIndex        =   2
      Top             =   120
      Width           =   375
   End
   Begin VB.Label Label4 
      Caption         =   "B="
      Height          =   375
      Left            =   1440
      TabIndex        =   1
      Top             =   120
      Width           =   375
   End
   Begin VB.Label Label3 
      Caption         =   "A="
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdCalcu_Click()
Dim a As Single, b As Single, c As Single
  Dim d As Single
  Dim x1 As Single, x2 As Single
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = b * b - 4 * a * c
If d >= 0 Then
x1 = (-b + Sqr(d)) / (2 * a)
x2 = (-b - Sqr(d)) / (2 * a)
Label1.Caption = Label1.Caption + Format(x1)
Label2.Caption = Label2.Caption + Format(x2)
End If
End Sub

⌨️ 快捷键说明

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