Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 26th, 2005, 3:20 PM   #1
adudley
Newbie
 
Join Date: Nov 2005
Posts: 3
Rep Power: 0 adudley is on a distinguished road
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
adudley is offline   Reply With Quote
Old Nov 26th, 2005, 3:31 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Hey, you can invent the marquee, then maybe the BLINK tag .
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 26th, 2005, 3:33 PM   #3
adudley
Newbie
 
Join Date: Nov 2005
Posts: 3
Rep Power: 0 adudley is on a distinguished road
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
adudley is offline   Reply With Quote
Old Nov 26th, 2005, 6:36 PM   #4
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
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
crawforddavid2006 is offline   Reply With Quote
Old Nov 26th, 2005, 9:51 PM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Nov 27th, 2005, 2:08 PM   #6
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Its been a while since I've used visual basic (1 yr to be exact).
crawforddavid2006 is offline   Reply With Quote
Old Nov 27th, 2005, 4:09 PM   #7
adudley
Newbie
 
Join Date: Nov 2005
Posts: 3
Rep Power: 0 adudley is on a distinguished road
no disrepect but thats really helpful
adudley is offline   Reply With Quote
Old Nov 27th, 2005, 4:21 PM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 28th, 2005, 11:56 AM   #9
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
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.
Rory is offline   Reply With Quote
Old Nov 28th, 2005, 7:20 PM   #10
melbolt
Hobbyist Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 244
Rep Power: 4 melbolt is on a distinguished road
Send a message via AIM to melbolt Send a message via Yahoo to melbolt
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.
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:44 AM.

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