|
-
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
|