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

📄 生肖.frm

📁 Visual Basic课程举例1 有很好的例题
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "计算生肖"
   ClientHeight    =   4365
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5415
   LinkTopic       =   "Form1"
   ScaleHeight     =   4365
   ScaleWidth      =   5415
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   11
      Left            =   2640
      Picture         =   "生肖.frx":0000
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   15
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   10
      Left            =   2640
      Picture         =   "生肖.frx":5076
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   14
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   9
      Left            =   2640
      Picture         =   "生肖.frx":A928
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   13
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   8
      Left            =   2640
      Picture         =   "生肖.frx":10DF8
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   12
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   7
      Left            =   2640
      Picture         =   "生肖.frx":16203
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   11
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   6
      Left            =   2640
      Picture         =   "生肖.frx":1BF6C
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   10
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   5
      Left            =   2640
      Picture         =   "生肖.frx":210BA
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   9
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   4
      Left            =   2640
      Picture         =   "生肖.frx":264E3
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   8
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   3
      Left            =   2640
      Picture         =   "生肖.frx":2BE35
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   7
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   2
      Left            =   2640
      Picture         =   "生肖.frx":3136E
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   6
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   1
      Left            =   2640
      Picture         =   "生肖.frx":52DB0
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   5
      Top             =   120
      Width           =   2535
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4095
      Index           =   0
      Left            =   2640
      Picture         =   "生肖.frx":58A2F
      ScaleHeight     =   4095
      ScaleWidth      =   2535
      TabIndex        =   3
      Top             =   120
      Width           =   2535
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   21.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   360
      TabIndex        =   2
      Text            =   "1988"
      Top             =   2040
      Width           =   1815
   End
   Begin VB.CommandButton CmdCalcu 
      Caption         =   "计算"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   360
      TabIndex        =   0
      Top             =   2880
      Width           =   1815
   End
   Begin VB.Label Label1 
      Caption         =   "在下面的文本框中输入你的出生年份,然后点“计算”查看你的生肖"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1575
      Left            =   360
      TabIndex        =   4
      Top             =   240
      Width           =   2055
   End
   Begin VB.Label Label2 
      Caption         =   "生肖"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   840
      TabIndex        =   1
      Top             =   3720
      Width           =   735
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' SELECT CASE 举例之 十二生肖
' 原作:佚名,改编:曹新国
' 最后修改日期:2006年4月7日,加上了生肖图片
'
' 说明,本例只是为了说明SELECT CASE的使用,当然有更好的办法来实现。
'
' 整个SELECT结构可以用下面这一条语句来实现,程序功能不变。
' Label2.Caption = Mid("鼠牛虎兔龙蛇马羊猴鸡狗猪",Year+1,1)


Private Sub CmdCalcu_Click()
 Dim Year As Integer
 
 Year = Val(Text1.Text)         '取出年份
 Year = (Year - 1972) Mod 12    '已经知道1984年属鼠
 
 If Year < 0 Then Year = Year + 12  '调整1984年以前的值
 
 Picture1(Year).Visible = True       '显示对应的生肖图片
 Picture1(Year).ZOrder 0
 
 Select Case Year   '现在 Year 已经调整为0到11间的数值
   Case 0
     Label2.Caption = "鼠"
   Case 1
     Label2.Caption = "牛"
   Case 2
     Label2.Caption = "虎"
   Case 3
     Label2.Caption = "兔"
   Case 4
     Label2.Caption = "龙"
   Case 5
     Label2.Caption = "蛇"
   Case 6
     Label2.Caption = "马"
   Case 7
     Label2.Caption = "羊"
   Case 8
     Label2.Caption = "猴"
   Case 9
     Label2.Caption = "鸡"
   Case 10
     Label2.Caption = "狗"
   Case 11
     Label2.Caption = "猪"
   Case Else
     Label2.Caption = "四不象"
   End Select
End Sub

Private Sub Form_Load()
    For i = 0 To 11
        Picture1(i).Visible = False
    Next i
End Sub

⌨️ 快捷键说明

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