Results 1 to 4 of 4

Thread: Creating Shapes During Program?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Davis, CA
    Posts
    23

    Question

    I have a program that I would like to be able to create a bunch of boxes from a set of coordinates from an outside file. Is there any way to have the program create a new box on its own, or do they have to all be made before the program starts?

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    look here, just replace "VB.CommandButton" with "VB.Shape"
    http://forums.vb-world.net/showthrea...threadid=40271
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Davis, CA
    Posts
    23
    Cool, Thanks.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I haven't tested this at all, just wrote it and there still to write if you want to write the file, the data is stored binary...
    Code:
    'this dynamic array will contain the shapes created in runtime
    'no need to mess with withevents since shapes don't have events.
    Private shapes() As shape
    'this is for the the stored properties of the shapes
    Private Type tshape
        top As Integer
        left As Integer
        width As Integer
        height As Integer
    End Type
    
    
    'this will open a file, read the amount of shapes, and then read the array of tshapes
        Dim count&, tshape() As tshape, x&
        Open file For Binary As #1
            Get #1, , count
            ReDim tshape(count - 1)
            Get #1, , tshape
        Close
        For x = 0 To count - 1
            'this will create the shape and put it in shapes array
            Set shapes(x) = Controls.Add("VB.Shape", "Shape" & x)
            With tshape(x)'then just set the properties up...
                shapes(x).left = .left
                shapes(x).top = .top
                shapes(x).width = .width
                shapes(x).height = .height
                shapes(x).shape = 0
                shapes(x).Visible = True
            End With
        Next x
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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