?
Solved

Rotating picture.

Posted on 2003-03-26
9
Medium Priority
?
331 Views
Last Modified: 2010-05-01
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
Comment
Question by:n-generation
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 17

Expert Comment

by:inthedark
ID: 8209792
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
 
LVL 53

Expert Comment

by:Dhaest
ID: 8209802
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
 
LVL 1

Expert Comment

by:sazhagianambi
ID: 8209804
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!

 

Author Comment

by:n-generation
ID: 8209912
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
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 220 total points
ID: 8210335
"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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8211604
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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8212633
C'mon!, i don't like points like this!!
Any commenter?, inthedark?,sazhagianambi?, Dhaest? or you, n-generation?
0
 
LVL 17

Expert Comment

by:inthedark
ID: 8216494
Hi richie it must be your lucky day! It could be a good day to invest in the stock market.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8217599
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question