• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

Rotating picture.

Currently I have four images of a frog facing four different directions.  Up, Down, Left, Right.  I want it to rotate.  (i.e. show each image) in order and you can see it rotate.  How do I get round doing this?
The frogs are in arrays.  Is ImgFrog(0) is Up, ImgFrog(1) is Right and go round clockwise etc.

Thanks!
0
n-generation
Asked:
n-generation
1 Solution
 
inthedarkCommented:
Do you mean like an animation.

The simple way is to use the micrrsoft freebie Microsoft Gif Animator. You can merge each picture into one GIF and set timing for each image.

Or using VB you can set a timer control to a have an interval value of say 500 (half a second). Increase to slow down, decrease to speed up or 0 to stop.


Sub Timer1_Timer()

Static lCurrentPicture as Long

imgFrog(lCurrentPicture).Visible = False
lCurrentPicture = lCurrentPicture + 1
if lCurrentPicture>3 Then
   lCurrentPicture=0
End If
imgFrog(lCurrentPicture).Visible = True

End Sub
0
 
DhaestCommented:
Do you want 1 image to rotate on it's centre point ?
(http://www.vbcode.com/code/imgedit.zip )

or just show the images after each other
(then I guess you'll have to use a timer, that after fe a minute changes the image in the imagebox)
0
 
sazhagianambiCommented:
Declare Variable i

Place One Timer.

Set The Interval as 1000
/*   Place The Following Code   */

Private Sub Timer1_Timer()
   i = i + 1
'   MsgBox i
   Load Picture According to i Value(If Pictures are     Named as Pic1,Pic2,Pic3,Pic4 Then it'll be easy
   If i = 4 Then
    i = 0
   End If
End Sub

/*   End Code   */

I Hope this'll Helps U.


Regards,
Nambi



0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
n-generationAuthor Commented:
There is something I forgot to mention.  Well I want the image to rotate at its centre.  So it is essentially displaying and hiding the images in turns.  so I can use a timer.  But how can I stop the rotattion after say two/three complete rotations?

0
 
Richie_SimonettiIT OperationsCommented:
"But how can I stop the rotattion after say two/three complete rotations?
"

use an static variable in you timer event

Private Sub Timer1_Timer()
static s as integer
if s=4 then
    timer1.enabled=false
else
    s=s+4
end if
'...
'...
' rest of the code here
end sub
0
 
Richie_SimonettiIT OperationsCommented:
well, there is a problem here: i just answer the last part of your question. Which one deserves the points for the rest of the problem. I could award her/him from my own bag.
0
 
Richie_SimonettiIT OperationsCommented:
C'mon!, i don't like points like this!!
Any commenter?, inthedark?,sazhagianambi?, Dhaest? or you, n-generation?
0
 
inthedarkCommented:
Hi richie it must be your lucky day! It could be a good day to invest in the stock market.
0
 
Richie_SimonettiIT OperationsCommented:
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now