Results 1 to 5 of 5

Thread: Adding Shapes during runtime

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    South Dakota
    Posts
    9

    Question Adding Shapes during runtime

    I need to add multiple shapes to my form during runtime . I would like to add these shapes as a dynamic control array. Any ideas from anyone?? Thanks in advance for any help.

  2. #2
    New Member
    Join Date
    Jan 2002
    Location
    Nottingham, England
    Posts
    1

    Arrow I have pretty much the same question...

    I need to draw rectangles on the screen at run time - a maximum of 640 of them. The trouble is, they need to fit in with some legacy code from previous versions of the program.

    Basically, depending on the status of a variable in an array, the program needs to be able to draw or remove a rectangle after the user clicks on the appropriate position on the form.

    The click-detection code, I can do. Getting the correct place for the rectangle to go (or disappear from), I can do.

    Actually getting it to:
    a) Draw the right colour rectangle in the right place
    b) Remove the CORRECT rectangle after another click

    - is beyond me.

    HELP!

  3. #3
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    When you want to load another member, use this code:
    VB Code:
    1. Load Picture1(Picture1.UBound + 1)
    I find this code very useful as it will find the last index in the control array and make one with an index one higher. Then you treat it like a normal control. To be able to do this, set a picturebox (eg. picture1)'s index property to 0. In a command button, run this code and (for example) randomize the left and top, maybe the width and height too.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    You can then save the index of the newly created control, and when it's clicked on again, make it invisible (or unload it)...
    VB Code:
    1. Picture1(ThisIndex).Visible = False
    2. Unload Picture1(ThisIndex)
    Cheers!
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    South Dakota
    Posts
    9

    Thanks

    Thanks for the help everyone. Much appreciated

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