Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Graphics Help Visual Basic
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CompN




PostPosted: Sun Nov 26, 2006 9:32 pm   Post subject: Graphics Help Visual Basic

Can somebody give me some hints on how to stop the that thing that is moving on the screen. For example I made the classic ball in the box, where the ball bounces off the perimeter.

How would I make the ball stop as in freeze when I click a button.

Any help would be great Smile
Sponsor
Sponsor
Sponsor
sponsor
md




PostPosted: Sun Nov 26, 2006 11:12 pm   Post subject: (No subject)

Uhh... C/C++ doesn't have built in graphics, so you must be using some graphics library. Since you didn't say what that was it's impossible help. Even if you did say which library, I have no idea what you are talking about... so unless code and or a screenshot is provided it's REALLY impossible to help.

So, what graphics library; and screnshot/code Razz
[Gandalf]




PostPosted: Sun Nov 26, 2006 11:33 pm   Post subject: (No subject)

Hmm... Actually I think this is a case of posting in the wrong section. He has "Visual Basic" in the topic title. Smile
CompN




PostPosted: Mon Nov 27, 2006 2:50 pm   Post subject: Re: Graphics Help Visual Basic

CompN wrote:
Can somebody give me some hints on how to stop the that thing that is moving on the screen. For example I made the classic ball in the box, where the ball bounces off the perimeter.

How would I make the ball stop as in freeze when I click a button.

Any help would be great Smile
Private Sub start_Click()
Dim Start As Integer
Dim nd As Integer
Dim changex As Integer
Dim changey As Integer
Dim x As Double
Start = 0
nd = 0
changex = 50
changey = 50
Do
ball.Left = ball.Left + changex
If ball.Left + ball.Width > Picture1.Width Then
changex = changex * -1
ElseIf ball.Left < 0 Then
changex = changex * -1
End If
ball.Top = ball.Top + changey
If ball.Top + ball.Height > Picture1.Height Then
changey = changey * -1
ElseIf ball.Top < 0 Then
changey = changey * -1
End If

For x = 0 To 1000
DoEvents
Next x
Loop
End Sub

This is the code


CompN




PostPosted: Mon Nov 27, 2006 3:58 pm   Post subject: (No subject)

Posted Image, might have been reduced in size. Click Image to view fullscreen.
md




PostPosted: Mon Nov 27, 2006 5:02 pm   Post subject: (No subject)

As this is VB can a mod move it to the Basic section? I haven't done anything in VB for so long I don't even want to try helping out here.
cool dude




PostPosted: Mon Nov 27, 2006 7:32 pm   Post subject: (No subject)

pretty easy. i'll help you when you properly indent your code and attach the form.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: