-
Feb 1st, 2013, 11:41 AM
#1
Thread Starter
Addicted Member
Animating picbox
Hey,
I am trying to animate a picturebox with code something like this
Code:
Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick
player.Image = ImageAnimator.Animate(My.Resources.Playerwalk, New EventHandler(AddressOf Me.OnFrameChanged))
End Sub
Private Sub OnFrameChanged(ByVal o As Object, ByVal e As EventArgs)
'Force a call to the Paint event handler.
Me.Invalidate()
End Sub
But it says imageAnimator.Animate expression does not produce a value.
I cant seem to find an example anywhere. Is there a right way to do it or an alternative?
I have a png of 256 wide and 80 high. each player frame is 32 wide and there are 8 different stages of movement. I want to draw the first 0-32 in a picturebox then the 32-64 and so on.
I have no idea what to do. Please help me
-
Feb 1st, 2013, 01:57 PM
#2
Re: Animating picbox
What is imageAnimator? Is it a custom class that you've created? Even so, animation in windows form applications are almost impossible. Not really impossible as more impractical. I would highly suggest using WPF or if you're insistant on using a windows form application, and using VS 2008 or higher, you could use XNA.
-
Feb 1st, 2013, 04:25 PM
#3
Re: Animating picbox
animation in windows form applications are almost impossible
Say what? To start with PictureBox is fully compatible with animated .gif which is more than adequate for most purposes and there are plenty of example projects out there for throbbers, animated progress reporters and all sorts.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Feb 1st, 2013, 04:30 PM
#4
Re: Animating picbox
player.Image = ImageAnimator.Animate(My.Resources.Playerwalk, New EventHandler(AddressOf Me.OnFrameChanged))
This is a direct call to a sub which returns no value so it's simply ...
ImageAnimator.Animate(My.Resources.Playerwalk, New EventHandler(AddressOf Me.OnFrameChanged))
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Feb 1st, 2013, 09:01 PM
#5
Re: Animating picbox
Originally Posted by dunfiddlin
Say what? To start with PictureBox is fully compatible with animated .gif which is more than adequate for most purposes and there are plenty of example projects out there for throbbers, animated progress reporters and all sorts.
did you read the next sentence?
Not really impossible as more impractical.
I was simply suggesting that it's far easier to do animation in WPF or use XNA.
-
Feb 2nd, 2013, 03:48 PM
#6
Re: Animating picbox
And I very much doubt that that's true either. ImageAnimator, by the way, is a native class under System.Drawing so MS certainly don't think that way.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Feb 3rd, 2013, 12:10 AM
#7
Re: Animating picbox
What ever dude. No need to be like that. I'm taking the unsubscribe route.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|