Results 1 to 3 of 3

Thread: How can I draw random circles in a picturebox?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    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!

  2. #2
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    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

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width