473,324 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

VB6 and Animations

What if i want to make an object tween across my form?

I have

Expand|Select|Wrap|Line Numbers
  1. While Kewlbuttons1.Top > 120
  2. Kewlbuttons1.Top = (Kewlbuttons1.Top - 5)
  3. Wend
  4.  
in a button, but, It just zips across insantly, leaving a black redraw space behind it.

How can I make it smoothly and slowly, go across?
Oct 21 '07 #1
3 1463
Killer42
8,435 Expert 8TB
Try putting a DoEvents inside the loop. If that doesn't work, we'll have to consider inserting a brief delay.
Oct 21 '07 #2
Try putting a DoEvents inside the loop. If that doesn't work, we'll have to consider inserting a brief delay.
focusing on delay, im having trouble with the timer control in my scenario. What is the proper use, and do you have an example that displays objects moving?
Oct 22 '07 #3
Killer42
8,435 Expert 8TB
focusing on delay, im having trouble with the timer control in my scenario. What is the proper use, and do you have an example that displays objects moving?
I'll have to go digging. You could try searching on a few combinations of terms here, such as "timer" and "animation" or something.

In the meantime, you could call a function that pauses for the specified number of seconds inside your loop. The function can do something like this...
Expand|Select|Wrap|Line Numbers
  1. Public Sub PauseFor(ByVal Seconds As Single)
  2.  
  3.   Dim EndTime As Date
  4.   EndTime = DateAdd("s", Seconds, Now)
  5.   Do
  6.     DoEvents
  7.   Loop Until Now >= EndTime
  8.  
  9. End Sub
Some things to be aware of here...
  • Since the argument is of type Single, you don't have to pass whole seconds. For instance, by passing 0.1 you could say to pause for a tenth of a second. I think.
  • Pausing for a few seconds using this routine may cause your CPU usage to look as though it's going through the roof, if you happen to look at the System Monitor (or whatever). However, since all it's doing in that loop is handing control back to Windows to do whatever (updating the display, etc.) it doesn't actually slow Windows down (at least in my experience).
  • I think there's also an API call you can do to just put this thread to sleep for a specified amount of time. Just can't remember it at the moment. It's probably called something along the lines of Sleep or Wait.
Oct 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Michel Gaudry | last post by:
Hello, I want to create a svg with multiple animations. It starts with <path> describing a Triangle and it's moved with a series of <animate>. An example : <path ...> <animate .../>...
1
by: Garry Gaves | last post by:
Hi @all, I'm currently writing a VB.NET project and I want to show some animations to the user (e.g. GIF, or any other format). How can I do that? I couldn't find a appropriate control for...
1
by: dzemo | last post by:
I want to make some simple animations in program (for example when showing some piece of form or some information on click) but I don't know how. I can change left property of form but there are no...
1
by: DrXavier | last post by:
Well I have not programmed in C++ for some length of time, so I will need a reffresher. On that note, I have never really written a real world app in any language. I would like to make a platform...
4
by: Fla | last post by:
Good morning. I'd like to know if I can use for free the animations, the bitmaps and the icons inside the archive VS2005ImageLibrary.zip in the installation path of VB2005 C:\Program...
2
by: Mike Stolkes | last post by:
I have the task to make 2 or 3 simple games, probably some shot them up game (space invaders or so) and a poker game. For this I need to move things around very quickly on the screen. So that is my...
7
by: kvnsmnsn | last post by:
I've got two GIF files named "Tigger.gif" and "Angry_barbarian.gif" that contain animations that I want to display on a web page. I've written the following XHTML code which works for a fraction...
5
by: vitaminB18 | last post by:
I want to make my forms unique with animations...i want the best codes for my main menu forms and other forms to make my database projects excellent. Im a student and the best design will receive an...
14
by: Mark | last post by:
I'm making a game. I need to maintain a bunch of objects, in this case animations (explosions and stuff). I've decided to use an STL vector. From my understanding, I need to declare it as...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.