【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了OPTIONS.FRM提供大家参考,希望对大家有所帮助!
VERSION 5.00
Begin VB.Form frmOptions
Caption = "“选项按钮”示例"
ClientHeight = 3825
ClientLeft = 3255
ClientTop = 2400
ClientWidth = 5505
LinkTopic = "Form1"
ScaleHeight = 3825
ScaleWidth = 5505
Begin VB.OptionButton opt686
Caption = "P&entium Pro"
Height = 255
Left = 360
TabIndex = 2
Top = 2040
Width = 1575
End
Begin VB.OptionButton opt586
Caption = "&Pentium"
Height = 255
Left = 360
TabIndex = 1
Top = 1560
Width = 1575
End
Begin VB.CommandButton cmdClose
Caption = "关闭(&C)"
Height = 495
Left = 3480
TabIndex = 5
Top = 2880
Width = 1695
End
Begin VB.OptionButton opt486
Caption = "&486"
Height = 255
Left = 360
TabIndex = 0
Top = 1080
Value = -1 'True
Width = 1575
End
Begin VB.Frame fraSystem
Caption = "操作系统"
Height = 1455
Left = 3000
TabIndex = 7
Top = 960
Width = 2175
Begin
VB.OptionButton optWin95
Caption = "&Windows 95"
Height = 255
Left = 360
TabIndex = 3
Top = 360
Value = -1 'True
Width = 1335
End
Begin VB.OptionButton optWinNT
Caption = "Windows &NT"
Height = 255
Left = 360
TabIndex = 4
Top = 840
Width = 1335
End
End
Begin VB.Label lblHelp
Caption = "选择处理器和操作
系统"
Height = 615
Left = 360
TabIndex = 8
Top = 2880
Width = 2295
End
Begin VB.Label lblDisplay
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 360
TabIndex = 6
Top = 360
Width = 4815
End
End
Attribute VB_Name = "frmOptions"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' 建立两个字符串变量保存标题
Dim strComputer As String
Dim strSystem As String
Sub DisplayCaption()
' 用两个字符串变量连结成标题
lblDisplay.Caption = "您选中了一台 " & _
strComputer & ",其正在运行 " & strSystem
End Sub
Private Sub cmdClose_Click()
Unload Me '卸载窗体
End Sub
Private Sub Form_Load()
' 调用缺省选项中的 Click 事件以更新标签的标题
opt486_Click
optWin95_Click
End Sub
Private Sub opt486_Click()
' 给第一个字符串变量赋值
strComputer = "486"
' 调用子过程
Call DisplayCaption
End Sub
Private Sub opt586_Click()
' 给第一个字符串变量赋值
strComputer = "Pentium"
' 调用子过程
Call DisplayCaption
End Sub
Private Sub opt686_Click()
' 给第一个字符串变量赋值
strComputer = "Pentium Pro"
' 调用子过程
Call DisplayCaption
End Sub
Private Sub optWin95_Click()
' 给第二个字符串变量赋值
strSystem = "Windows 95"
' 调用子过程
Call DisplayCaption
End Sub
Private Sub optWinNT_Click()
' 给第二个字符串变量赋值
strSystem = "Windows NT"
' 调用子过程
Call DisplayCaption
End Sub