Results 1 to 7 of 7

Thread: Create Control at Runtime

  1. #1

    Thread Starter
    Fanatic Member Alien_poo's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    668

    Create Control at Runtime

    Please ignore my other post, here is a new one:

    What I need to do is:

    I have a form, when I click anywhere on the form, I need a Image CREATED. Where? I need it CREATED on the closest pre-defined Top and Left. (Ex. I have 2 Tops: 1 and 5 and 2 Lefts: 1 and 5. If I click Top:2 and Left:3, I need my Image created on Top1, Left 5)

    Now each time I click on the form, my app will create a new image, I need these images placed in an array (First time I click my Image will be Img(0), the second time I click my image will be Img(1), etc.)

    Is this possible? If yes, can someone please help me?

    There is a certain pattern to the pre-defined Tops and Lefts:
    Top: 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 1320, 1320, 1320, 1320, etc.
    Left: 360, 1320, 2280, 3240, 4200, 5160, 6120, 7080, 8040, 9000, 360, 1320, 2280, 3240, etc.
    "A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
    "First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
    - Robert Matthews, Science Correspondent

  2. #2
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    OK:

    VB Code:
    1. 'Decleration:
    2. Dim ImgNo as Integer
    3.  
    4. ' Form Load:
    5. ImgNo = 0
    6.  
    7. ' You Need At Least one control ALREADY IN YOUR PROJECT!!!
    8. ' Just make it visible, etc.
    9. ' Next One:
    10. Dim PreTop as Integer, PreLeft as Integer
    11. PreTop= ??
    12. PreLeft= ??
    13. ImgNo = ImgNo + 1
    14. Load img(ImgNo)
    15. Img(ImgNo).Top = PreTop
    16. Img(ImgNo).Left = PreLeft
    17.  
    18. 'ETC..
    19. ' Make sure you unload all your Images made:
    20.  
    21. If Img.Count > 1 Then
    22.  Dim I as Integer
    23.  For I=1 To Img.Count
    24.      Unload Img(I)
    25.  Next I
    26. End If

    Dat should fix it for you?

    You need to make the left & Top still though, just fill in the ??
    : Hope it helps :P
    Wayne

  3. #3

    Thread Starter
    Fanatic Member Alien_poo's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    668
    Originally posted by wpearsall
    OK:

    VB Code:
    1. 'Decleration:
    2. Dim ImgNo as Integer
    3.  
    4. ' Form Load:
    5. ImgNo = 0
    6.  
    7. ' You Need At Least one control ALREADY IN YOUR PROJECT!!!
    8. ' Just make it visible, etc.
    9. ' Next One:
    10. Dim PreTop as Integer, PreLeft as Integer
    11. PreTop= ??
    12. PreLeft= ??
    13. ImgNo = ImgNo + 1
    14. Load img(ImgNo)
    15. Img(ImgNo).Top = PreTop
    16. Img(ImgNo).Left = PreLeft
    17.  
    18. 'ETC..
    19. ' Make sure you unload all your Images made:
    20.  
    21. If Img.Count > 1 Then
    22.  Dim I as Integer
    23.  For I=1 To Img.Count
    24.      Unload Img(I)
    25.  Next I
    26. End If

    Dat should fix it for you?

    You need to make the left & Top still though, just fill in the ??
    : Hope it helps :P
    yes this helps, thx. 2 things:
    1. Why do I have to unload my image????
    2. My PreTop and PreLeft have to be the closest Top and Left to where i clicked
    "A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
    "First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
    - Robert Matthews, Science Correspondent

  4. #4

    Thread Starter
    Fanatic Member Alien_poo's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    668
    PLLLLZZZ someone!!
    "A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
    "First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
    - Robert Matthews, Science Correspondent

  5. #5
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    Unload the images, on form unload,

    to reduce memory usage (And it will make sure it frees the usage if the app doesn't unload em with "Unload Me"

    PreTop =
    and
    PreLeft =

    This is mainly the bit u need to do,

    I dont know how ur getting ur Two No's, so cant help u there?

    When u get your two numbers, it should be able to get it then?
    Wayne

  6. #6

    Thread Starter
    Fanatic Member Alien_poo's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    668
    I got it all working THX a lot!!
    "A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
    "First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
    - Robert Matthews, Science Correspondent

  7. #7
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    YW, No Problem

    Might be interested in this too:
    VB Code:
    1. img(i).ZOrder(0) ' Bring the control Forward
    2. img(i).ZOrder(1) ' Send the control Back

    Incase u wanna order the forms etc,
    Wayne

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