Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   how to move a vb label across the screen and then back again (http://www.programmingforums.org/showthread.php?t=7210)

adudley Nov 26th, 2005 3:20 PM

how to move a vb label across the screen and then back again
 
hi all i need a little help, i am working on a project and i need to make a label move accross the screen and back again once it come to the end of the open form.

any help on this would be appriciated

a dudley

DaWei Nov 26th, 2005 3:31 PM

Hey, you can invent the marquee, then maybe the BLINK tag :D .

adudley Nov 26th, 2005 3:33 PM

what i have to do is try to use cos and sin to make this thing work, so all i am after is the basoc raw code so i can manipulate it

any help is always appriciated

a dudley

crawforddavid2006 Nov 26th, 2005 6:36 PM

use a clock or timer i cant remember exactly what its called but then use something like this
:

Label1.Left = Clock1.whatever the increment is called

Ooble Nov 26th, 2005 9:51 PM

Crawford's almost there - you need to alter the Left property of the Label. Create a Timer control, set the interval to something low (like 10 - it's measured in milliseconds), double-click on it, and put this in:
:

Label1.Left = Label1.Left - 1
That will move the label to the left by one pixel roughly once every ten milliseconds. Play with the values to get the right speed and smoothness.

You'll also need to move the label when it goes off the screen - I'll let you figure that one out.

crawforddavid2006 Nov 27th, 2005 2:08 PM

Its been a while since I've used visual basic (1 yr to be exact).

adudley Nov 27th, 2005 4:09 PM

no disrepect but thats really helpful

DaWei Nov 27th, 2005 4:21 PM

Quote:

no disrepect but thats really helpful
Prolly not yer wisest move to say so, disrespect intended or not. His post was helpful, if incomplete, and your respondents aren't exactly tearing down the walls.

Rory Nov 28th, 2005 11:56 AM

You mentioned Sine so I guess you're trying to achieve a smooth bounce effect or similar. May I suggest you use the GDI APIs or DirectDraw, as even with double buffering (AutoRedraw), the native VB graphical methods won't get you a decent enough refresh rate.

melbolt Nov 28th, 2005 7:20 PM

if you're just going with a simple approach to this, just check to see when the furthest left pixel of your object you are scrolling hits the right edge of the window and then send it back to the starting point again.


All times are GMT -5. The time now is 11:16 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC