Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > Random Bouncing Object


Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2005, 05:10 PM
cuteboy86 cuteboy86 is offline
Newcomer
 
Join Date: Sep 2005
Posts: 1
Default Random Bouncing Object


Hey everyone. I am new to the Visual Basic and computer programming world in general! I was wondering how to get an image file to move around and actually bounce off the edges of a fixed border form! I thought that it would be four simple "If...Then... Statements" where I would say that when the image got to a certain point, to turn and go the other way. Unfortunately, that doesn't work and I don't know what to do???? Can U PLEASE HELP???
Reply With Quote
  #2  
Old 09-13-2005, 06:19 PM
passel's Avatar
passel passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,722
Default

Could you show the code you tried.
It would be best to set the scalemode of the Form to pixels, so that you know precisely the position and width and height of your image.
What exactly is your image? Something in a picturebox, or an imagebox?
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #3  
Old 09-13-2005, 10:21 PM
zelg37 zelg37 is offline
Contributor

* Expert *
 
Join Date: Dec 2004
Location: Oregon, USA
Posts: 606
Default Bouncing ball image using picturebox and bitblt

To see how to use bitblt (my personally preferred method) to bounce an image off the edges of a form, you can use the download link (at the bottom of this page) to get the attached sample/demo:
http://www.vb-helper.com/howto_overl...g_picture.html

However if you insist on using controls (as passel suggests), a picturebox control is always preferred over an image control (which can be somewhat flickery).

The attached demo uses a property I rarely use - the .Tag property (a "cubbyhole" in a picturebox control to stuff data into..)
Attached Files
File Type: zip Bounce_using_picturebox.zip (2.9 KB, 9 views)

Last edited by zelg37; 09-13-2005 at 11:35 PM.
Reply With Quote
  #4  
Old 09-14-2005, 01:18 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,931
Default

Have a look at this oldskool demo I once made in VB:
http://www.vorlon.nl/flyguy/vb/sin.html
Reply With Quote
Reply


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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->