form1.frm

来自「visualbasic学习材料及开发源代码」· FRM 代码 · 共 131 行

FRM
131
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4890
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4890
   StartUpPosition =   3  '窗口缺省
   Begin VB.OptionButton optHexButton 
      Caption         =   "Hex"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3360
      TabIndex        =   4
      Top             =   1800
      Width           =   1215
   End
   Begin VB.OptionButton optDecButton 
      Caption         =   "Decimal"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1920
      TabIndex        =   3
      Top             =   1800
      Width           =   1335
   End
   Begin VB.OptionButton optOctButton 
      Caption         =   "Octal"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   720
      TabIndex        =   2
      Top             =   1800
      Width           =   1215
   End
   Begin VB.TextBox txtNumberBox 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1920
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   840
      Width           =   2295
   End
   Begin VB.Label Label1 
      Caption         =   "Number:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   600
      TabIndex        =   0
      Top             =   840
      Width           =   1335
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CurrentValue As Single

Private Sub Form_Load()
optDecButton.Value = True
End Sub

Private Sub optDecButton_Click()
txtNumberBox.Text = Format$(CurrentValue)
End Sub

Private Sub optHexButton_Click()
txtNumberBox.Text = Hex$(CurrentValue)
End Sub

Private Sub optOctButton_Click()
txtNumberBox.Text = Oct$(CurrentValue)
End Sub

Private Sub txtNumberBox_Change()
If optOctButton.Value Then
   CurrentValue = Val("&o" + LTrim$(txtNumberBox.Text) + "&")
ElseIf optDecButton.Value Then
   CurrentValue = Val(LTrim$(txtNumberBox.Text) + "&")
Else
   CurrentValue = Val("&H" + LTrim$(txtNumberBox.Text) + "&")
End If
End Sub

⌨️ 快捷键说明

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