返回首页

您好,
我有一个PictureBox,我需要的动画,即移动和改变形象。

Imports System

Imports System.Drawing

Public Class Form1

 

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Static x As Integer = 5

        Static y As Integer = 0

        Static flip As Integer = False

        If y Mod 2 = 0 Then

            Me.PictureBox1.Image = My.Resources.Resource1.Bird_l

        Else

            Me.PictureBox1.Image = My.Resources.Resource1.bird_r

        End If

        If Me.PictureBox1.Left >= 500 Then

            x = -5

            flip = True

        ElseIf Me.PictureBox1.Left <= 0 Then

            x = 5

            flip = False

        End If

        If flip = True Then

            Me.PictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipX)

        End If

        Me.PictureBox1.Left = Me.PictureBox1.Left + x

        y += 1

    End Sub

End Class

在运行时,它显示错误行: -

Me.PictureBox1.Image = My.Resources.Resource1.bird_r
- "参数不合法"

为什么是错误的?

thanxDEB4u

回答

评论会员: 时间:2