ctips.frm
来自「VB精彩百例」· FRM 代码 · 共 86 行
FRM
86 行
VERSION 5.00
Begin VB.Form frmTips
BorderStyle = 3 'Fixed Dialog
Caption = " Tip of the Day"
ClientHeight = 2325
ClientLeft = 3975
ClientTop = 3495
ClientWidth = 4650
ControlBox = 0 'False
Icon = "cTips.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 2325
ScaleWidth = 4650
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdAnother
Caption = "&Another..."
Height = 495
Left = 2280
TabIndex = 1
Top = 1740
Width = 1035
End
Begin VB.CommandButton cmdOK
Cancel = -1 'True
Caption = "&OK"
Default = -1 'True
Height = 495
Left = 3480
TabIndex = 0
Top = 1740
Width = 1035
End
Begin VB.Label lblTip
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "Label1"
BeginProperty Font
Name = "MS Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1515
Left = 120
TabIndex = 2
Top = 120
Width = 4395
End
End
Attribute VB_Name = "frmTips"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' Define the collections object
Private m_colTips As cTips
Private Sub cmdAnother_Click()
' Another random tip
Dim sTip As String 'store temp tip here
sTip = lblTip 'initialize it
While sTip = lblTip 'same?
sTip = m_colTips.NextTip 'Select a random tip
Wend
lblTip = sTip 'display it
End Sub
Private Sub cmdOK_Click()
Unload Me 'unload the form
End Sub
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2 'center me
Set m_colTips = New cTips 'Create the instance
lblTip = m_colTips.RandomTip 'Select a random tip
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set m_colTips = Nothing 'Clear all object references
Set frmTips = Nothing
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?