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

📄 frmmsgbox.frm

📁 Visual Basic 6 大学教程的代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMsgBox 
   Caption         =   "Fig. 10.41: Function MsgBox"
   ClientHeight    =   3765
   ClientLeft      =   2460
   ClientTop       =   1785
   ClientWidth     =   4755
   LinkTopic       =   "Form1"
   ScaleHeight     =   3765
   ScaleWidth      =   4755
   Begin VB.Frame fraModal 
      Caption         =   "Modal"
      Height          =   855
      Left            =   2400
      TabIndex        =   3
      Top             =   1800
      Width           =   2175
      Begin VB.OptionButton optModal 
         Caption         =   "vbSystemModal"
         Height          =   255
         Index           =   4096
         Left            =   120
         TabIndex        =   15
         Top             =   480
         Width           =   1455
      End
      Begin VB.OptionButton optModal 
         Caption         =   "vbApplicationModal"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   14
         Top             =   240
         Width           =   1695
      End
   End
   Begin VB.Frame fraIcon 
      Caption         =   "Icon"
      Height          =   1575
      Left            =   2400
      TabIndex        =   2
      Top             =   120
      Width           =   2175
      Begin VB.OptionButton optIcon 
         Caption         =   "vbInformation"
         Height          =   375
         Index           =   64
         Left            =   240
         TabIndex        =   13
         Top             =   1080
         Width           =   1575
      End
      Begin VB.OptionButton optIcon 
         Caption         =   "vbExclamation"
         Height          =   255
         Index           =   48
         Left            =   240
         TabIndex        =   12
         Top             =   840
         Width           =   1815
      End
      Begin VB.OptionButton optIcon 
         Caption         =   "vbQuestion"
         Height          =   375
         Index           =   32
         Left            =   240
         TabIndex        =   11
         Top             =   480
         Width           =   1695
      End
      Begin VB.OptionButton optIcon 
         Caption         =   "vbCritical"
         Height          =   255
         Index           =   16
         Left            =   240
         TabIndex        =   10
         Top             =   240
         Width           =   1815
      End
   End
   Begin VB.Frame fraType 
      Caption         =   "Button Type"
      Height          =   2535
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   2055
      Begin VB.OptionButton optType 
         Caption         =   "vbRetryCancel"
         Height          =   315
         Index           =   5
         Left            =   120
         TabIndex        =   9
         Top             =   2040
         Width           =   1815
      End
      Begin VB.OptionButton optType 
         Caption         =   "vbYesNo"
         Height          =   375
         Index           =   4
         Left            =   120
         TabIndex        =   8
         Top             =   1680
         Width           =   1575
      End
      Begin VB.OptionButton optType 
         Caption         =   "vbYesNoCancel"
         Height          =   375
         Index           =   3
         Left            =   120
         TabIndex        =   7
         Top             =   1320
         Width           =   1575
      End
      Begin VB.OptionButton optType 
         Caption         =   "vbAbortRetryIgnore"
         Height          =   375
         Index           =   2
         Left            =   120
         TabIndex        =   6
         Top             =   960
         Width           =   1695
      End
      Begin VB.OptionButton optType 
         Caption         =   "vbOKCancel"
         Height          =   375
         Index           =   1
         Left            =   120
         TabIndex        =   5
         Top             =   600
         Width           =   1695
      End
      Begin VB.OptionButton optType 
         Caption         =   "vbOKOnly"
         Height          =   375
         Index           =   0
         Left            =   120
         TabIndex        =   4
         Top             =   240
         Width           =   1575
      End
   End
   Begin VB.CommandButton cmdDisplay 
      Caption         =   "Display"
      Height          =   495
      Left            =   1680
      TabIndex        =   0
      Top             =   2760
      Width           =   1215
   End
   Begin VB.Label lblDisplay 
      Height          =   375
      Left            =   0
      TabIndex        =   16
      Top             =   3360
      Width           =   4695
   End
End
Attribute VB_Name = "frmMsgBox"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 10.41
' Demonstrating Function MsgBox
Option Explicit              ' General declaration
Dim mButtonType As Integer   ' General declaration
Dim mButtonIcon As Integer   ' General declaration
Dim mModal As Integer        ' General declaration

Private Sub Form_Load()
   mButtonType = vbOKOnly
   mButtonIcon = vbCritical
   mModal = vbApplicationModal
   
   optType(mButtonType).Value = True
   optIcon(mButtonIcon).Value = True
   optModal(mModal).Value = True
End Sub

Private Sub cmdDisplay_Click()
   Dim r As Integer
   
   r = MsgBox("Visual Basic 6 How To Program", _
              mButtonType + mButtonIcon + mModal, "VBHTP")
               
   ' Determine which MsgBox button was pressed
   Select Case r
      Case vbOK
         lblDisplay.Caption = "OK was pressed."
      Case vbCancel
         lblDisplay.Caption = "Cancel was pressed."
      Case vbAbort
         lblDisplay.Caption = "Abort was pressed."
      Case vbRetry
         lblDisplay.Caption = "Retry was pressed."
      Case vbIgnore
         lblDisplay.Caption = "Ignore was pressed."
      Case vbYes
         lblDisplay.Caption = "Yes was pressed."
      Case vbNo
         lblDisplay.Caption = "No was pressed."
   End Select
   
End Sub

Private Sub optIcon_Click(Index As Integer)
   mButtonIcon = Index
End Sub

Private Sub optType_Click(Index As Integer)
   mButtonType = Index
End Sub

Private Sub optModal_Click(Index As Integer)
   mModal = Index
End Sub

⌨️ 快捷键说明

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