首页上一页 1 下一页尾页 1 条记录 1/1页
老师您好,我想把原本的小老鼠gif图片改成其它gif图片,需要如何操作?谢谢
发表在VB图书答疑
2020-07-24
《Visual Basic精彩编程200例》第1章 窗体界面与控件 73页-74页
是否精华
是
否
版块置顶:
是
否
Dim n, s As Integer '定义全局变量 Private Sub Command1_Click() Timer1.Interval = 1000 Command4.Enabled = True End Sub Private Sub Command2_Click() Timer1.Interval = 800 Command4.Enabled = True End Sub Private Sub Command3_Click() Timer1.Interval = 700 Command4.Enabled = True End Sub Private Sub Command4_Click() n = 0: s = 0 '变量n用来存储击中砖块的次数,变量s用来存储所用的时间,赋值0 Label1.Caption = "" Text1.Text = 0 Image1.Visible = True Image1.Left = 2600 Image1.Top = 2000 Command1.Enabled = False: Command2.Enabled = False Command3.Enabled = False Command4.Enabled = False Timer1.Enabled = True Timer2.Enabled = True Timer3.Enabled = True End Sub Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) n = n + 1 Text1.Text = n ' Image1.Caption = n Image1.MousePointer = 99 - custom Image1.MouseIcon = Image3.Picture End Sub Private Sub Command6_Click() Unload Me End Sub Private Sub Form_Load() Label2.Visible = False End Sub Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Image1.MousePointer = 99 - custom Image1.MouseIcon = Image2.Picture End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Picture1.MousePointer = 99 - custom Picture1.MouseIcon = Image3.Picture End Sub Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Picture1.MousePointer = 99 - custom Picture1.MouseIcon = Image2.Picture End Sub Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Picture1.MousePointer = 99 - custom Picture1.MouseIcon = Image2.Picture End Sub Private Sub Timer1_Timer() Randomize ' 初始化随机变量 R = Int(Rnd * 256 + 0) ' 把Rnd函数生成的随机数赋给变量R G = Int(Rnd * 256 + 0) ' 把Rnd函数生成的随机数赋给变量G B = Int(Rnd * 256 + 0) ' 把Rnd函数生成的随机数赋给变量B L = Int(Rnd * 5000 + 0) ' 把Rnd函数生成的随机数赋给变量L T = Int(Rnd * 2000 + 0) ' 把Rnd函数生成的随机数赋给变量T ' Image1.BackColor = RGB(R, G, B) ' 用生成的变量R、G、B的制设置砖块的颜色 Image1.Left = Picture1.Left + L ' 用生成的变量L的值设置砖块的left位置 Image1.Top = Picture1.Top + T ' 用生成的变量T的值设置砖块的top位置 End Sub Private Sub Timer2_Timer() Timer1.Enabled = False Timer3.Enabled = False Image1.Visible = False Command1.Enabled = True Command2.Enabled = True Command3.Enabled = True If Text1.Text < 10 Then MsgBox "打小偷技术不是很好哟,继续努力" ElseIf Text1.Text < 20 Then MsgBox "真牛X!" Else MsgBox "打小偷英雄!" End If End Sub Private Sub Timer3_Timer() s = s + 1 Label1.Caption = 30 - s End Sub
于2020-07-25 09:07:01编辑