|
-
Sep 3rd, 2017, 11:35 PM
#1
Thread Starter
PowerPoster
How can I draw random circles in a picturebox?
Hi there folks. I am working on a program to teach students how to subitize numbers. Subitizing is a fancy of saying you can look at a random arrangement of items/dots and know what the total is without counting. For example, how we can roll dice and know what the number showing is without counting the dots.
However, I want to challenge the students so the dots are drawn in a variety of random arrangements. Instead of just "rolling" a 4 for example and have the dots in their regular spots, I would like the dots to be drawn in a random arrangement within a certain border area, such as a picturebox.
Would anyone have any experience with generating random spots for VB6 to draw dots? Right now, I have it so the program randomly picks a number from 1-10 and puts it in a label called QPickLBL.caption.
Thanks a ton!
-
Sep 4th, 2017, 07:16 AM
#2
Re: How can I draw random circles in a picturebox?
Justin
A little confused .. circles vs dots
Do you want to draw circles of same diameter with their centers at random positions within a PB?
If not, where did I misinterpret you.
Spoo
-
Sep 4th, 2017, 07:36 AM
#3
Re: How can I draw random circles in a picturebox?
I would think one of the requirements would be that the dots don't overlap each other. One idea would be to divide the picturebox into contiguous squares, a grid. The size of a square equals the diameter of the dot. So, you'll know the coordinates of each square (simple grid navigation), therefore, you'll know the center of each square.
Let's say there are 25 squares, a 5x5 grid. You can randomly choose squares from a list 1-25. Locate the square in the grid and draw the dot from the center of the square with a radius of 1/2 of the square's size. After dot is drawn, remove the selected square location from the list and repeat. To start again, recreate the list, random select from list, draw dot, and so on.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|