Image Grid? Please help! RRS feed

  • Question

  • Hi,

    Sorry if this is silly question but I am a bit new to C# dev. I want to load images dynamically on a form in a way that the images get automatically resized depending on the number of images to fill their parent container.

    Let's say for argument's sake that all my images are 300x300 px. I do not know in advance how many images will be loaded as this is done dynamically. The result I wish to achieve is the following:

    - If there is only one image, it should fill the parent container (and naturally get pixelated, that's fine)
    - If there are 2, they should be resized as to fill the parent container
    - When there are four, they should evenly divide the parent's container are and take each quadrant
    .... and so on...

    I think of it as an image grid, that as more images are loaded, they get shrunk, so that they entirely fill their parent container, and vice-versa. Is there an easy and straightforward way of accomplishing this?

    I tried using picture box, but for that, its seems that I have to specify by hand the position of each image and I was hoping to avoid that.

    Any help would be extremely appreciated. Thanks!!
    • Moved by Peter Ritchie Thursday, June 19, 2008 7:43 PM off-topic
    Thursday, June 19, 2008 3:51 PM


All replies