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

📄 form1.frm

📁 vb程序实现的是一个动态漂亮红灯笼
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   1170
   ClientLeft      =   7590
   ClientTop       =   5850
   ClientWidth     =   1650
   LinkTopic       =   "Form1"
   MouseIcon       =   "form1.frx":0000
   Picture         =   "form1.frx":0ABA
   ScaleHeight     =   1170
   ScaleWidth      =   1650
   ShowInTaskbar   =   0   'False
   Begin VB.PictureBox Picture0 
      Height          =   255
      Left            =   0
      Picture         =   "form1.frx":1A56
      ScaleHeight     =   195
      ScaleWidth      =   315
      TabIndex        =   3
      Top             =   240
      Visible         =   0   'False
      Width           =   375
   End
   Begin VB.PictureBox Picture3 
      Height          =   375
      Left            =   1200
      Picture         =   "form1.frx":2978
      ScaleHeight     =   315
      ScaleWidth      =   315
      TabIndex        =   2
      Top             =   240
      Visible         =   0   'False
      Width           =   375
   End
   Begin VB.PictureBox Picture2 
      Height          =   375
      Left            =   840
      Picture         =   "form1.frx":383B
      ScaleHeight     =   315
      ScaleWidth      =   315
      TabIndex        =   1
      Top             =   120
      Visible         =   0   'False
      Width           =   375
   End
   Begin VB.PictureBox Picture1 
      Height          =   375
      Left            =   360
      Picture         =   "form1.frx":4709
      ScaleHeight     =   315
      ScaleWidth      =   315
      TabIndex        =   0
      Top             =   240
      Visible         =   0   'False
      Width           =   375
   End
   Begin VB.Timer Timer1 
      Left            =   120
      Top             =   720
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Dim My_Picture(0 To 3) As Picture
Dim Times As Integer
Dim hRgn As Long
Dim MouseDown As Boolean
Dim TmpX, TmpY As Single


Private Sub Form_DblClick()
Unload Form1
Unload Form2
End Sub

Private Sub Form_Load()
Set My_Picture(0) = Picture0.Picture
Set My_Picture(1) = Picture1.Picture
Set My_Picture(2) = Picture2.Picture
Set My_Picture(3) = Picture3.Picture

SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, &H1 Or &H2

tims = 0
Timer1.Interval = 200
Timer1.Enabled = True
Form1.Picture = My_Picture(0)

MouseDown = False
hRgn = CreateEllipticRgn(0, 0, Form1.ScaleX(Form1.Width, vbTwips, vbPixels), Form1.ScaleY(Form1.Height, vbTwips, vbPixels))
SetWindowRgn Form1.hwnd, hRgn, True
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
MouseDown = True
TmpX = x
TmpY = y
If Button = vbRightButton Then
End If
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If (MouseDown) Then
Form1.Move Form1.Left + (x - TmpX), Form1.Top + (y - TmpY)
End If
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
MouseDown = False

If Button = vbRightButton Then
MsgBox "Computer00 祝大家元宵节快乐!" & vbCrLf & "欢迎访问我的个人博客:http://computer00.21ic.org", vbOKOnly, "欢度新春"
End If

While (Form1.Top - 150 > 0 Or Form1.Left - 100 > 0)
If Form1.Top - 150 > 0 Then Form1.Move Form1.Left, Form1.Top - 100
If Form1.Left - 100 > 0 Then Form1.Move Form1.Left - 80, Form1.Top
DoEvents
Sleep 10
Wend
End Sub

Private Sub Form_Unload(Cancel As Integer)
End
End Sub

Private Sub Timer1_Timer()
Form1.Picture = My_Picture(Times)
Times = Times + 1
If Times = 4 Then Times = 0
End Sub

⌨️ 快捷键说明

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