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

📄 喷泉.frm

📁 一个简单的模拟喷泉的VB代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BackColor       =   &H00FFFFFF&
   Caption         =   "喷泉"
   ClientHeight    =   3150
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   4680
   Icon            =   "喷泉.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   3150
   ScaleWidth      =   4680
   StartUpPosition =   2  '屏幕中心
   Begin VB.Timer Timer1 
      Interval        =   50
      Left            =   0
      Top             =   2760
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   10
      Left            =   1590
      Picture         =   "喷泉.frx":0442
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   9
      Left            =   1590
      Picture         =   "喷泉.frx":A0C6
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   8
      Left            =   1590
      Picture         =   "喷泉.frx":13D4A
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   7
      Left            =   1590
      Picture         =   "喷泉.frx":1D9CE
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   6
      Left            =   1590
      Picture         =   "喷泉.frx":27652
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   5
      Left            =   1590
      Picture         =   "喷泉.frx":312D6
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   4
      Left            =   1590
      Picture         =   "喷泉.frx":3AF5A
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   3
      Left            =   1590
      Picture         =   "喷泉.frx":44BDE
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   2
      Left            =   1590
      Picture         =   "喷泉.frx":4E862
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   1
      Left            =   1590
      Picture         =   "喷泉.frx":584E6
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
   Begin VB.Image img2 
      Height          =   495
      Left            =   3240
      Top             =   2520
      Width           =   1215
   End
   Begin VB.Image img1 
      Height          =   1500
      Index           =   0
      Left            =   1590
      Picture         =   "喷泉.frx":6216A
      Top             =   825
      Visible         =   0   'False
      Width           =   1500
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim i As Integer                                    '定义变量
Private Sub form_load()                             '下面代码实现图像框img2居中显示
img2.Left = (ScaleWidth - img2.Width) / 2
img2.Top = (ScaleHeight - img2.Height) / 2
End Sub
Private Sub timer1_timer()
If i = 10 Then i = 0                                '如果变量i为10,则i为0
i = i + 1                                           '变量i不断变化
Select Case i                                       '将i作为测试表达式
Case 0                                              'i为0时
img2.Picture = img1(1).Picture                      '将索引为1的图像框中的图片赋给img2
img1(1).Left = img2.Left                            '图像框img1(1)与img2的水平位置相同
img1(1).Top = img2.Top                              '图像框img1(1)与img2的垂直位置相同
Case 1
img2.Picture = img1(2).Picture
img1(2).Left = img2.Left
img1(2).Top = img2.Top
Case 2
img2.Picture = img1(3).Picture
img1(3).Left = img2.Left
img1(3).Top = img2.Top
Case 3
img2.Picture = img1(4).Picture
img1(4).Left = img2.Left
img1(4).Top = img2.Top
Case 4
img2.Picture = img1(5).Picture
img1(5).Left = img2.Left
img1(5).Top = img2.Top
Case 5
img2.Picture = img1(6).Picture
img1(6).Left = img2.Left
img1(6).Top = img2.Top
Case 6
img2.Picture = img1(7).Picture
img1(7).Left = img2.Left
img1(7).Top = img2.Top
Case 7
img2.Picture = img1(8).Picture
img1(8).Left = img2.Left
img1(8).Top = img2.Top
Case 8
img2.Picture = img1(9).Picture
img1(9).Left = img2.Left
img1(9).Top = img2.Top
Case 9
img2.Picture = img1(10).Picture
img1(10).Left = img2.Left
img1(10).Top = img2.Top
End Select
End Sub
     
                                                 

⌨️ 快捷键说明

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