How do you add a drawcircle in a class module.
I then need to add a control array in the form to add additional circles, and have the circles bounce against the lower boundary of the form.
Any help would be appreciated
Elasciticity, Spin, conservation of momentum, drag, (side) boundray conditions, inital momentum, inital direction ...?
are they (the 'balls') all the same?
MichaelRed
redmsp@erols.com
There is never time to do it right but there is always time to do it over
The balls are all the same, made from the circle, then a control array.
You set the upper limit of the array to 4.
A timer object control the speed of bouncing balls against the bottom edge of the form.
If you are using a control array and all of the balls are exactly the same, what do you intend to store in the class object? Right now, I do not see any reason why you would need a class module . . . some more info please. - Jeff Marler B-)
creating classes, objects of a class type and using graphical techniques.
To start with we will create a class mycircle which has following property values
X coordinate
Y coordinate
Radius
Now add a DrawCircle method to this class which will accept following parameters
canvas as an object (the object on which you want to draw a cicle)
Fillcolor (The fillcolor for the canvas object to show the circle filled) and will draw a circle on the canvas object using the internal property
Create an object of mycircle during the formload event and write necessary code to make this object bounce against the lower boundry of the form. Test your procedure
Next step is to create a control array of mycircle objects and place them randomly on the form. Through a timer object control the speed of bouncing of the balls agaist the bottom edge of the form. You set the upper limit of array to 4 only
First of all, if you are creating multiple instances of your class, these would not qualify as a control array (unless you are using an OCX). You would want to store the multiple references in a Collection
Secondly, for the canvas, pass in a reference to the form where you will be drawing these circles. For example . . .
Code:
Public Sub DrawCircle(frmCanvas as Form1,lngFillColor as Long)
{Do Something}
{Draw your circle out on the local form reference}
Code:
End Sub
Finally, you will also need some public attributes to set your X and Y coord or you should pass those into your draw method. - Jeff Marler B-)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.