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

📄 form1.frm

📁 送给同学的一个作为生日礼物的程序
💻 FRM
字号:
VERSION 5.00
Object = "{D27CDB6B-AE6D-11CF-96B8-444553540000}#1.0#0"; "Flash8.ocx"
Begin VB.Form Form1 
   Caption         =   "生日快乐哈!"
   ClientHeight    =   6900
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9030
   LinkTopic       =   "Form1"
   ScaleHeight     =   6900
   ScaleWidth      =   9030
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command5 
      Caption         =   "讨厌!重画!"
      Height          =   495
      Left            =   4080
      TabIndex        =   20
      Top             =   2880
      Width           =   735
   End
   Begin VB.Frame Frame2 
      Caption         =   "我要换笔!"
      Height          =   615
      Left            =   120
      TabIndex        =   15
      Top             =   2760
      Width           =   3735
      Begin VB.OptionButton Option2 
         Caption         =   "10"
         Height          =   255
         Index           =   4
         Left            =   2880
         TabIndex        =   21
         Top             =   240
         Width           =   615
      End
      Begin VB.OptionButton Option2 
         Caption         =   "8"
         Height          =   255
         Index           =   3
         Left            =   2160
         TabIndex        =   19
         Top             =   240
         Width           =   615
      End
      Begin VB.OptionButton Option2 
         Caption         =   "6"
         Height          =   255
         Index           =   2
         Left            =   1440
         TabIndex        =   18
         Top             =   240
         Width           =   615
      End
      Begin VB.OptionButton Option2 
         Caption         =   "4"
         Height          =   255
         Index           =   1
         Left            =   840
         TabIndex        =   17
         Top             =   240
         Width           =   615
      End
      Begin VB.OptionButton Option2 
         Caption         =   "2"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   16
         Top             =   240
         Value           =   -1  'True
         Width           =   615
      End
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Okey,STOP!"
      Height          =   375
      Left            =   2640
      TabIndex        =   14
      Top             =   3480
      Width           =   1575
   End
   Begin ShockwaveFlashObjectsCtl.ShockwaveFlash ShockwaveFlash1 
      Height          =   2655
      Left            =   120
      TabIndex        =   13
      Top             =   4080
      Width           =   4695
      _cx             =   8281
      _cy             =   4683
      FlashVars       =   ""
      Movie           =   ""
      Src             =   ""
      WMode           =   "Window"
      Play            =   -1  'True
      Loop            =   -1  'True
      Quality         =   "High"
      SAlign          =   ""
      Menu            =   -1  'True
      Base            =   ""
      AllowScriptAccess=   ""
      Scale           =   "ShowAll"
      DeviceFont      =   0   'False
      EmbedMovie      =   0   'False
      BGColor         =   ""
      SWRemote        =   ""
      MovieData       =   ""
      SeamlessTabbing =   -1  'True
      Profile         =   0   'False
      ProfileAddress  =   ""
      ProfilePort     =   0
   End
   Begin VB.CommandButton Command3 
      Caption         =   "来看动画哈!"
      Height          =   375
      Left            =   240
      TabIndex        =   12
      Top             =   3480
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Caption         =   "想换颜色吗?come here~~"
      Height          =   975
      Left            =   120
      TabIndex        =   6
      Top             =   1680
      Width           =   4695
      Begin VB.OptionButton Option1 
         Caption         =   "黄色"
         Height          =   495
         Index           =   4
         Left            =   3600
         TabIndex        =   11
         Top             =   360
         Width           =   975
      End
      Begin VB.OptionButton Option1 
         Caption         =   "红色"
         Height          =   495
         Index           =   3
         Left            =   2640
         TabIndex        =   10
         Top             =   360
         Width           =   855
      End
      Begin VB.OptionButton Option1 
         Caption         =   "绿色"
         Height          =   495
         Index           =   2
         Left            =   1800
         TabIndex        =   9
         Top             =   360
         Width           =   975
      End
      Begin VB.OptionButton Option1 
         Caption         =   "蓝色"
         Height          =   495
         Index           =   1
         Left            =   960
         TabIndex        =   8
         Top             =   360
         Width           =   855
      End
      Begin VB.OptionButton Option1 
         Caption         =   "黑色"
         Height          =   495
         Index           =   0
         Left            =   120
         TabIndex        =   7
         Top             =   360
         Value           =   -1  'True
         Width           =   1695
      End
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   5895
      Left            =   5040
      ScaleHeight     =   5865
      ScaleWidth      =   3825
      TabIndex        =   4
      Top             =   840
      Width           =   3855
   End
   Begin VB.Timer Timer2 
      Interval        =   500
      Left            =   600
      Top             =   720
   End
   Begin VB.CommandButton Command2 
      Caption         =   "想画画吗?"
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   960
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "有惊喜哦!"
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1455
   End
   Begin VB.Timer Timer1 
      Interval        =   500
      Left            =   6000
      Top             =   0
   End
   Begin VB.Label Label1 
      Caption         =   "生日快乐哈! 老刘同志!"
      Height          =   255
      Left            =   6840
      TabIndex        =   5
      Tag             =   "2"
      Top             =   120
      Width           =   2055
   End
   Begin VB.Label Label3 
      Caption         =   " 来画画喽~~   画板在这里-----〉      随便画哈~~    "
      ForeColor       =   &H00FF0000&
      Height          =   615
      Left            =   2280
      TabIndex        =   3
      Top             =   960
      Width           =   2415
   End
   Begin VB.Image Image1 
      Height          =   5895
      Left            =   5040
      Stretch         =   -1  'True
      Top             =   840
      Width           =   3855
   End
   Begin VB.Label Label2 
      Caption         =   "小马跑了,蹬儿~蹬儿~蹬儿~蹬儿~~"
      ForeColor       =   &H000000FF&
      Height          =   255
      Left            =   2040
      TabIndex        =   1
      Top             =   360
      Width           =   3015
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Const GCL_HCURSOR = (-12)
Private Declare Function LoadCursorFromFile Lib "user32" _
                Alias "LoadCursorFromFileA" _
                (ByVal lpFileName As String) _
                As Long
                
Private Declare Function SetClassLong Lib "user32" _
                Alias "SetClassLongA" _
                (ByVal hwnd As Long, _
                ByVal nIndex As Long, _
                ByVal dwNewLong As Long) _
                As Long
                
Private Declare Function GetClassLong Lib "user32" _
                Alias "GetClassLongA" _
                (ByVal hwnd As Long, _
                ByVal nIndex As Long) _
                As Long
                Dim x1 As Integer   '起点X坐标
Dim y1 As Integer   '起点Y坐标
Dim x2 As Integer   '终点点X坐标
Dim y2 As Integer   '终点Y坐标
Dim flag As Boolean '绘图标志

                


Sub changcolor(LCnt As Control, color1 As Integer, _
                color2 As Integer, color3 As Integer, _
                color4 As Integer, color5 As Integer, _
                color6 As Integer, color7 As Integer, _
                color8 As Integer)
    Dim tmep As Integer
    tmep = Val(LCnt.Tag)
    Select Case tmep
    Case color1
        LCnt.Tag = color2
    Case color2
        LCnt.Tag = color3
    Case color3
        LCnt.Tag = color4
    Case color4
        LCnt.Tag = color5
    Case color5
        LCnt.Tag = color6
    Case color6
        LCnt.Tag = color7
    Case color7
        LCnt.Tag = color8
    Case color8
        LCnt.Tag = color1
    End Select
    LCnt.ForeColor = QBColor(LCnt.Tag)
    '

End Sub

Private Sub Command1_Click()
    Dim mhBaseCursor As Long, mhAniCursor As Long
    Dim lResult As Long
    Label2.Visible = True
    Picture1.Visible = False
    If Right(App.Path, 1) = "\" Then
        mhAniCursor = LoadCursorFromFile(App.Path + "horse.ani")
        Image1.Picture = LoadPicture(App.Path + "jing1.jpg")
    Else
        mhAniCursor = LoadCursorFromFile(App.Path + "\horse.ani")
        Image1.Picture = LoadPicture(App.Path + "\jing1.jpg")
    End If
    lResult = SetClassLong(Me.hwnd, GCL_HCURSOR, mhAniCursor)
End Sub

Private Sub Command2_Click()
Picture1.Visible = True
Label3.Visible = True
Frame1.Visible = True
Frame2.Visible = True
Command5.Visible = True
End Sub

Private Sub Command3_Click()
Picture1.Visible = False
Image1.Picture = LoadPicture(App.Path + "\chun.jpg")
ShockwaveFlash1.Movie = App.Path + "\happy.swf"
ShockwaveFlash1.Play
End Sub

Private Sub Command4_Click()
 If Command4.Caption = "Okey,STOP!" Then
        ShockwaveFlash1.Playing = False
        '停止动画
        Command4.Caption = "Continue..."
    Else
        ShockwaveFlash1.Playing = True
        '继续动画
        Command4.Caption = "Okey,STOP!"
    End If
End Sub

Private Sub Command5_Click()
Picture1.Cls
End Sub

Private Sub Form_Load()
    Label2.Visible = False
    Picture1.Visible = False
    Label3.Visible = False
    Frame1.Visible = False
    Frame2.Visible = False
    Command5.Visible = False
    If Right(App.Path, 1) = "\" Then
        Image1.Picture = LoadPicture(App.Path + "cover.bmp")
    Else
        Image1.Picture = LoadPicture(App.Path + "\cover.bmp")
    End If
End Sub

Private Sub Option1_Click(Index As Integer)
Select Case Index
Case 0
     Picture1.ForeColor = vbBlack
Case 1
     Picture1.ForeColor = vbBlue
Case 2
     Picture1.ForeColor = vbGreen
Case 3
     Picture1.ForeColor = vbRed
Case 4
     Picture1.ForeColor = vbYellow
End Select
End Sub

Private Sub Option2_Click(Index As Integer)
Select Case Index
Case 0
     Picture1.DrawWidth = 2
Case 1
     Picture1.DrawWidth = 4
Case 2
     Picture1.DrawWidth = 6
Case 3
     Picture1.DrawWidth = 8
Case 4
     Picture1.DrawWidth = 10
End Select
End Sub

Private Sub Timer1_Timer()
    changcolor Label1, 2, 3, 4, 5, 6, 7, 8, 9
    If Label1.Left < 0 Then
    Label1.Left = Form1.Width
    Else
    Label1.Left = Label1.Left - 200
    End If
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, _
                               X As Single, Y As Single)
'当按下鼠标按键时绘图开始并记录最初的起点
    flag = True
    x1 = X
    y1 = Y
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, _
                               X As Single, Y As Single)
'如果不是处在绘图状态则退出该过程
'如果处在绘图状态则从起点到目前鼠标所在点绘制直线
'然后将当前鼠标所在点作为新的起点
    If flag = False Then
        Exit Sub
    End If
    If flag = True Then
        x2 = X
        y2 = Y
        Picture1.Line (x1, y1)-(x2, y2)
        x1 = x2
        y1 = y2
    End If
End Sub


Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, _
                             X As Single, Y As Single)
'当释放鼠标按键时绘图结束
    flag = False
End Sub

⌨️ 快捷键说明

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