Results 1 to 7 of 7

Thread: Image Control at run-time

  1. #1

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205

    Question Image Control at run-time

    Heya,

    I am trying to write a prog that will allow someone to construct a big picture by dragging some preset 'tiles' into place.

    The problem I am having is that I would like for them to be able to drag more than one tile to the same place (so that I don't have to include a tile for every possible combination of layouts).

    I have tried several methods, to no avail, my closest attempt being one that works, but buggers up colours when some tiles are dragged over others.

    Is it possible to create an Image control at runtime and display it on the form?

    Or does anyone have another suggestion?

    Cheers.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Yeah just give it an Index = 0 and then Load more with higher indices
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    I actually tried that, but the new controls never appeared.
    I gave them pics, and set them to visible, and made sure they were in the right place, but they never showed up.
    They were there, 'cause I got 'already loaded' errors when I was testing, but I couldn't see them, which kind of defeated the purpose...

    I have found another way which was I think Controls.AddControl, and it will do for now, but it seemed weird that the Load method wouldn't work right?
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  4. #4
    Addicted Member Bazza81's Avatar
    Join Date
    Apr 2001
    Location
    Nottingham, UK
    Posts
    203
    Some things to consider:

    [list=1][*]Your forms scalemode is in pixels not twips hence when placing new control it buggers up[*]Have you used Control.zOrder to bring the control to the top?[/list=1]

    Hope this helps
    Who needs rhetorical questions anyway?


    Bazza NET - The place you want to be!

  5. #5

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    The scalemode should only affect the location, and I am aware of that - I know the correct x,y to put controls, and yes I did use ZOrder.

    It still didn't show up...?

    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  6. #6
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Try putting a picture in it
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  7. #7

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    done and done.

    I can't have pictures in it at design-time, since it doesn't exist. At run-time I use Picture=LoadPicture(filename).

    Same result.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

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